Form Generation Library |
[eluser]macigniter[/eluser]
[quote author="happydude" date="1263366995"] The problem I am having with this is that when I click the submit button regardless of whether the data validates (and updates the database) or does not, it is the old database values that get populated as default values in the fields..... until the next edit of the same row comes up.[/quote] Question: So your form initially populates the values from the database, then you type in some new values and submit the form. If the form is INvalid, still the old database values are being repopulated??
[eluser]happydude[/eluser]
[quote author="macigniter" date="1263395978"][quote author="happydude" date="1263366995"] The problem I am having with this is that when I click the submit button regardless of whether the data validates (and updates the database) or does not, it is the old database values that get populated as default values in the fields..... until the next edit of the same row comes up.[/quote] Question: So your form initially populates the values from the database, then you type in some new values and submit the form. If the form is INvalid, still the old database values are being repopulated??[/quote] Exactly... Probably due to the way FGL handles user-specified default values.
[eluser]macigniter[/eluser]
[quote author="happydude" date="1263481214"] Exactly... Probably due to the way FGL handles user-specified default values.[/quote] That's strange... check out the demo form. There's some default text in the textarea. If you type in something else and submit it doesn't re-populate the default...
[eluser]happydude[/eluser]
Then, it could be the way my code is structured... I'll try to make it follow the pattern in the example. Does the demo form use the $this->form->valid condition?
[eluser]macigniter[/eluser]
[quote author="happydude" date="1263487423"]Then, it could be the way my code is structured... I'll try to make it follow the pattern in the example. Does the demo form use the $this->form->valid condition?[/quote] That's how the demo handles it: Code: $data['form'] = $this->form->get();
[eluser]hugle[/eluser]
what version of LIB are you using? what PHP version?
[eluser]macigniter[/eluser]
[quote author="hugle" date="1263489458"]what version of LIB are you using? what PHP version?[/quote] It's the current 1.0 version with PHP 5.2.11 Try using $this->form->get() BEFORE the if ($this->form->valid) (get() automatically validates the form, so no need for calling ->validate()) Then, do a redirect upon successful form submission to load the newly updated values from the db...
[eluser]hugle[/eluser]
[quote author="happydude" date="1263487423"]Then, it could be the way my code is structured... I'll try to make it follow the pattern in the example. Does the demo form use the $this->form->valid condition?[/quote] Hello have you solved your problem?
[eluser]seanloving[/eluser]
Fetch an inventory list and display it in a table. In the "QTY" column I want to call adjust to get the text box portion of the form: Code: function adjust( $val, $caller ) Code: function adjust_submit( $caller ) At the second call (to adjust_submit) I'm getting this error: Code: Undefined variable: form_0 How do I work this? --Sean Loving |
Welcome Guest, Not a member yet? Register Sign In |