From: David <da...@df...> - 2004-05-22 15:37:12
|
> But how would you handle the fact of having to save all the form data > when a check fails ? > It is necessary since the form will have to be > displayed again. Then reset() will be necessary anyway since form data > > might have been saved anyway... Well, you could use one-script forms like that: $fs = &new Formsess(..); if ($fs->wasSubmitted() && !$fs->hasErrors()) { doSomethingWithTheFormData(); // and redirect to another page } else { $smarty->display(myform.tpl); } Which 'loops' as long until there're no errors left and the form data is processed. No need for save at all anymore, since the smarty functions, executed with display use getValue which directly reads from the form data. :-) If you use different scripts for displaying the form and processing the data, nothing would change at all. (except that you could use getValue() before saving) You will still need to save() and reset(). |