RE: Your Work

well... I am still working that out (dynamic form structure)... but
currently, what I do is a bit different than that. Every Control and every
Group has an attribute called "repeat", and here's what it means:

	0 - Does not repeat
	-1 - Repeat unlimited
	n - Group/Control may repeat n times

Any Group or Element that can repeat has add/remove buttons. Which triggers
a form post. The form post passes as the submit value: [add/remove][id]

Then, what I do is use an XPATH query to find the element with the "id"
value passed. If the command is "remove", I simply delete the element from
the tree and write out the XML. If the command is "add". I use the cloneNode
method of IXMLDOMNode.
and add it after the current node (clone deep to get the whole fragment). I
clear all of the non-static controls' "value" attributes. But there needs to
be some flexibility here (line item number auto-increment for example on a
static control).

When adding, you need to be careful to "re"-id the new groups/controls... I
keep a "nextid" attribute handy in a separate element (called "Layout") to
help make sure I don't duplicate "id" values. The whole thing breaks down if
you don't ensure uniqueness.

The other issue I haven't solved here is how to allow business
element/groups to be added to a form where none exist. In my previous
example, let's say we have 2 line items, once I have deleted them both, I
have none left to clone or remove... how do I get a line item back on the
form?

Robert Fox
Program Manager
Softshare
EM: robertf@softshare.com
PH:(805) 899-2366
FX: (805) 882-2599 


-----Original Message-----
From: Rob Williams [mailto:robwms63@yahoo.com]
Sent: Tuesday, May 09, 2000 10:29 AM
To: 'www-forms@w3.org'
Subject: RE: Your Work


Sounds excellent, Robert! I wnat to go over this in
more detail. 

Your last comment about adding and removing groups is
something I am trying to workout right now. What
mechanism did you construct for that? I have a series
of 30 rule fragments that I need to allow the user to
appropriate as needed, and supply values for. I was
thinking an XML tree for all the fragments then
another for the selected ones and simply grafting
'groups' (using your nomenclature) to the selected
tree each time they ask for another fragment. I know
that can be done w/XSLT, but how are you actually
wiring those types of events in your architecture?

Thanks, 

Rob

--- Robert Fox <robertf@softshare.com> wrote:
> Well... currently I have "solved" it procedurally,
> but basically, I have a
> concept of a Control, and a Group, a Group can
> contain other Groups, or
> Controls. The key here is that EVERY Group or
> Control has an attribute named
> "id", and that "id" must be unique. Then, the XSLT
> that produces that HTML
> form actually sets the "name" attribute of the
> <INPUT> block = to the "id"
> of the Control being displayed, for example, here is
> the XSLT for an EDIT
> control:
> 
> 		<xsl:when test=".[@type = 'edit']">
> 			<xsl:value-of select="@caption"/>
> 			<input>
> 				<xsl:attribute name="name"><xsl:value-of
> select="@id"/></xsl:attribute>
> 				<xsl:attribute
> name="type">text</xsl:attribute>
> 				<xsl:attribute name="size"><xsl:value-of
> select="@width"/></xsl:attribute>
> 				<xsl:attribute
> name="maxlength"><xsl:value-of
> select="@maxlen"/></xsl:attribute>
> 				<xsl:attribute name="value"><xsl:value-of
> select="@value"/></xsl:attribute>
> 			</input>
> 		</xsl:when>
> 
> When the form is POSTED, I do the following:
> 1) Save all "id"/"value" pairs into a map
> 2) Do an XPATH query on the DOM looking for all
> elements named "Control"
> 3) If the "id" for the current element is in the
> map, I update the "value"
> attribute of the element (all "id"s appear in the
> map with the exception of
> static controls, which contribute nothing to a form
> post event).
> 4) Write out the XML. We are now update and ready
> for re-editing.
> 
> I also assign IDs to Groups, to allow the user the
> ability to dynamically
> add/remove groups of controls...
> 
> Robert Fox
> Program Manager
> Softshare
> EM: robertf@softshare.com
> PH:(805) 899-2366
> FX: (805) 882-2599 
> 
> -----Original Message-----
> From: Rob Williams [mailto:robwms63@yahoo.com]
> Sent: Monday, May 08, 2000 5:29 PM
> To: robertf@softshare.com
> Subject: Your Work
> 
> 
> Where is your stuff? I'd be interested to see what
> you've done regarding loading and unloading values
> onto the form. I too have been working that problem
> of
> late.
> 
> Rob Williams
> Chief Architect
> ClickAction
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Send instant messages & get email alerts with Yahoo!
> Messenger.
> http://im.yahoo.com/
> 

__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/

Received on Tuesday, 9 May 2000 13:46:59 UTC