I have a problem with dynamic added field to the form. The followingFirst, you shouldn't test for "isSuccessful" in more( ) because that will require validation, which means that the one input box that you DO have will need to be non-empty. But that's not the meat of your question, I see.
code creates one input field and two submit buttons. I would like to
add more (up to 4) input fields after pressing "more" button. It does
not work and I have no idea how to solve it.
If I read this right, you want the "more" action to just add two more input boxes to the form. I'm not sure what your len(filter( etc is all about, but you can easily measure len(self.form.fields()).
Because the action methods (in this case, "more") happen before writeHTML, by the time the form is dumped, it should have the new fields, and therefore be painted. So far, so good, but that only gets you the first half. The new fields will be sent in the subsequent client POST, but the _receiving_servlet_ will still only look for the original fields, as set up in the new awake.
So, you need to have some kind of flag (in session, querystring, whatever) that tells the receiving servlet to make the extra fields during build-up and to therefore parse them.
Aaron Held is right, there's no guarantee that the same user will get the same servlet, but the design of FormKit is to assume nothing; in your case, a new form class instance is re-created on each awake, which is correct (for what you're trying to do). We never assume that a form instance sticks around for multiple state-preserving transactions. If a form is not dynamic, you can re-use it, but no state is preserved (unless you forget to reset the forms in sleep or elsewhere - wink).
------------------------------------------------------- This SF.net email is sponsored by: Perforce Software. Perforce is the Fast Software Configuration Management System offering advanced branching capabilities and atomic changes on 50+ platforms. Free Eval! http://www.perforce.com/perforce/loadprog.html _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss
