I have a form where user enters some data and another form(well just a few input fields) embedded with javascript from another page that handles some other data. The embedded form has its own validation and on validation error of the embedded form I call a javascript function that refreshes the page. My problem is that the values in the form get deleted and the user has to enter all of them again. I know if an error occurs in a yii form the values are retained and error message is displayed, but I had no luck finding out how to trigger this with javascript or any other way. So the question is how can I trigger that behavior?
A refresh is a request to the server to render the same view again…
When rendering a view… to display values… the server has to know those values…
If a user enters something in a input box… and you refresh the page… the server does not know the value entered… cannot display it…
If a user enters something in a input box and the form is submitted to the server… the server knows the values entered ($_POST or $_GET)… can display it…
Using js / jQuery you can submit any entered value to the server as soon as the user leaves the input field… this is happening with validation…