developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Changes between Initial Version and Version 2 of Ticket #1071


Ignore:
Timestamp:
Jul 21, 2010, 12:11:20 AM (11 years ago)
Author:
laurentj
Comment:

you may want to clear() a jForm after making a fill() (if entered data is not accepted by your app).

Why doing a clear ? If you clear the form when there is an error, so the user loose all values he typed. Not very cool.

And I don't see when data are overlaped, with or without clear(). Because on each tab, when you submit, then you call fill(), and fill() overwrite data in the container in the session. So, what is the problem ?

destroyAllInstances(): why not..

getInstancesCount(): why not, but I think it is useless. jForms is designed to not manage ourselves instances... So what is the use case of this method ? Give me an example please.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #1071 – Description

    initial v2  
    1010
    1111With those 3 additional methods, you could use jForms as is :
    12 - prepare : create() a jForms, whatever get() is (you may test getInstancesCount() if you want to avoid to many creations). Multiple create() on a given selector won't bloat $_SESSION since it just increments a counter. You may clean() before create() to remove old instances.
    13 - show : if you need to, setData() to some fields, fetch() your template assigning him the form and then clear() the form. This prevents multiple jForms data overlap
    14 - save : fill() your form. If there are data errors, clear() it and redirect to show(). If everything is OK, store your data or whatever you have to do with them, clear() your jForms and go to "end"
    15 - end : destroy() your jForms
     12
     13   * prepare : create() a jForms, whatever get() is (you may test getInstancesCount() if you want to avoid to many creations). Multiple create() on a given selector won't bloat $_SESSION since it just increments a counter. You may clean() before create() to remove old instances.
     14   * show : if you need to, setData() to some fields, fetch() your template assigning him the form and then clear() the form. This prevents multiple jForms data overlap
     15   * save : fill() your form. If there are data errors, clear() it and redirect to show(). If everything is OK, store your data or whatever you have to do with them, clear() your jForms and go to "end"
     16   * end : destroy() your jForms
    1617
    1718