Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't update the Lform values using JQuery #42

Closed
shanilsasikumar opened this issue Jun 29, 2020 · 2 comments
Closed

Can't update the Lform values using JQuery #42

shanilsasikumar opened this issue Jun 29, 2020 · 2 comments

Comments

@shanilsasikumar
Copy link

shanilsasikumar commented Jun 29, 2020

I have updated the form filed values using JQuery , I can see the values changed in the DOM. But when I'm trying to access the form values using LForms.Util.getFormData the changed values are not getting.

For example, the initial value of my phone number is 'XXX-XXXXX' and changed to 'YYYY-YYYY' using JQuery.But When I trying to get the form values using LForms.Util.getFormData the value of phone number is still 'XXX-XXXXX' .

How can I get the values without rendering the Lform?

@plynchnlm
Copy link
Member

The form you see is just view of LForms' internal data model, which is what getFormData() uses. If you need to change a field with jQuery (or other JavaScript) you will need to fire events so that the event listeners for the data model know something changed. Perhaps firing a change event on the field would be enough, though you might need to fire key events (probably just the last key).

@shanilsasikumar
Copy link
Author

The form you see is just view of LForms' internal data model, which is what getFormData() uses. If you need to change a field with jQuery (or other JavaScript) you will need to fire events so that the event listeners for the data model know something changed. Perhaps firing a change event on the field would be enough, though you might need to fire key events (probably just the last key).

Thank you @plynchnlm It's working fine when I fire a change event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants