In part of my form, I have 3 inputs (one textarea and two text inputs), I am validating their value format using AJAX (each input triggers error message on its label in case format is wrong). Also I have one button, "NOT submit button" (type = button).
Now, when clicking on the button it must enter the value of those three inputs in my database in case they are true then all inputs values must be cleared. In case AJAX validation is wrong and in case the user clicked on that button, the value of fields must kept as it is.
Actually I can not use submit button because I have it for the whole form and what I am taking about is a part of the form and it's not possible to make nested forms as I know it violates html rules. It's easy to make it if I am taking about submitting button as I can view session values on fields after submission in case ajax returns error.
Each input field has AJAX Error message that will be triggered when the input format is wrong.
If AJAX validation is giving wrong, and if the user clicks on that button, all fields must kept same.
If AJAX validation is giving "no error" and when the user clicks on that button, all fields must be cleared and values will be transferred to database.
The question how to keep values in case ajax return errors and how to clear them in case ajax returns "no errors" :)
Your advice will be highly appreciated.
Thanks in advance.