From: Rimon B. <ba...@cs...> - 2003-06-10 00:42:59
|
Hi Scott, I think I understand what you are trying to do, and I would suggest a small modification. From my understanding you would like to write: <me:form data=foo> <input type=text ...> </me:form> The 'form' tag in the library loaded under the 'me' prefix can do what you request. First, you need to turn on buffering for the tag. See: http://spyce.sourceforge.net/doc-tag_new.html All you need to do is define buffer = 1 in the class that defines the 'form' tag. Then, the body() method of the 'form' tag will get called with the contents of the tag. That is, it will receive, as a string, the result of the internal processing. You can perform all the logic that you like on that body, and prepopulate it with data at that point, and print whatever you like. You don't have to print the original contents. Just remember to return false, or the tag will loop. That should work... The modification that I would suggest is as follows. It should make things a little more efficient and remove the dependency on regular expression replacements, which are inherently tricky. The suggestion is not currently possible with the current tag architecture, but I've been meaning to add it for a while. What I would like to see for form prepopulating is the following: <me:form data=foo> <me:input type=text .../> </me:form> The only difference from the above is that the internal input tag is now an active tag. It acts just like a normal input tag, but it access it's parent active form tag and fills its own state in. That's the part that is not currently possible. You can't crawl up the active tag hierarchy. Does that sound like something you would be interested in? All the best, Rimon. On Tue, 29 Apr 2003, Scott Chapman wrote: >Rimon, > >I'm still tinkering with ideas on how to set up form pre-populating. > >I've come up with a notion and want to see how this would work in Spyce. I'm >thinking of making a special tag, me:form, that simply surrounded the form >portion of the html document. The contents of the form would be parsed and >prepopulated (this is actually looks fairly easy using re or HTMLParser). > >The question is how do I put the output back into the Spyce engine so that >subsequent Spyce tags or code segments will be handled by Spyce? Is this >automatically handled by Spyce or do I need to do something convoluted to >make Spyce handle the stuff in the form section that I don't touch with my >form pre-population? > >Scott |