Randall Randall wrote:
On Thursday, September 18, 2003, at 02:39 PM, Randall Randall wrote:
On Thursday, September 18, 2003, at 12:54 PM, Matt Feifarek wrote:
Randall Randall wrote:
I need to create a number of forms that depend on how many objects there are to modify. If there are 3, there need to be 3 forms, one of which will be used.
This should be no problem; we do it all the time. Just make sure that you're using different submit methods (actions) for each one.
That seems tricky; I'd had every form using the same submit method and the method was cycling through every form in self._forms to find the successful one that had called it.
So, to do this, I'd need to define a generic method and use setattr to set the name of each copy to the name of the submit button as it's generated?
It turns out that this works for me. Those extra forms still crept into self._forms, but simply checking to see whether the new submit method was registered for each iteration of creating a form was sufficient to weed it out.
Oh, I see what you mean, now. Since you don't know how many forms you'll have, the name of the submit method isn't necessarily predictable. Yes, I'd stick with one submit method, and just make it a bit more sophisticated about how it does processing. Grabbing "__formID__" from the posted fields, and corresponding that to self._forms should help.
I'm still not very clear on the "recommended" way to create forms in awake(), since the way I'm doing it, by manipulating self._forms, doesn't seem very natural. If this is the right way, I can create an example for your Examples folder. If not, and you find the time before the next release, an example of a form created in awake() would be helpful, I think. :)
There's nothing special about awake, really. It's just a method, like any other. The fact that it's called every page load may lead to an explanation about why you're getting extra forms, but it's certainly not designed to work that way.
That having been said, if you come up with a cool example, of course we're interested.
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss