Referring to the screenshot, and I have a form and some button to call the update function via the ajax. I can able to update the field from the backend, but how can I also update the field value from the frontend instead of reloading the page?
I am not going to submit the form but only update a particular field and then update the display in form. I will do update_post_meta(), the value in field won’t be refreshed without reload the form but I want to update the display using javascript, I need to know how to get the element and change the display if I have the field wpcf-. Should I change the label or something?
I'm not sure if I understand what you are aiming for.
If this is a form with fields, then when someone enters a value in a field, then the field shows that value. There is nothing to update in the form itself, because it displays the value the user just entered. But at this stage the value is only in the form in the browser of the user; until the form is submitted the field value in the database doesn't get updated.
If you want to somehow have a user enter a value in a field in the form and then update the value of the field in the database without submitting the form, then that's not possible. (Well, you can create a custom solution that involves sending the value via ajax whenever the field input changes, and on the server responding to the ajax request and updating the field value with update_post_meta. But that isn't something dependent on Toolset, it is very much a custom solution.)
The topic ‘[Closed] Update the form field after an ajax call’ is closed to new replies.