jshood
10-11-2004, 10:25 AM
In order to create a user customizable database app. I'm attempting to create a data entry form that dynamically creates and labels all the input boxes.
My goal is to read an XML file that contains the label,name and datapath of the nessecary input boxes.
Using the code below I've been able to create the input boxes and assign them a proper datapath. However it appears that since they are created dynamically they do not follow the layout rules of the view I am placing them in. Or they are not being placed inside the target view at all.
I could write a script to manually provide x & y values as I create the objects, however I'm wondering if there is a better way. My main concern is that I would like to wrap this up as a class and place it inside a larger application. Therefore if the x & y coordinates are relative to the canvas and not the class view I would be overlapping items.
Secondly I'm wondering how this method compares performance wise, to generating the LZX on the fly using Coldfusion or PHP. Rather than having the LZX dynamically create the objects.
Thanks for the assistance
Here's the important snippets....
<dataset name="fields" >
<nodes>
<field>
<fieldName>phWork1</fieldName>
<fieldDesc>Work 1</fieldDesc>
</field>
<field>
<fieldName>phWork2</fieldName>
<fieldDesc>Work 2</fieldDesc>
</field>
</nodes>
</dataset>
<class name="dynField" >
<attribute type="string" name="fN" />
<attribute type="string" name="fD" />
<simplelayout axis="x" />
<text name="label" text="${parent.fD}" />
<etPhone name="phone" datapath="${'dset:/contacts/contact/phones/'+ parent.fN +'/text()'}" />
</class>
<datapointer name="dp_fields" xpath="fields:/" ondata="printData()">
<method name="printData">
this.selectChild(2)
var i = 50;
do{
i = i + 50;
fN = this.xpathQuery('fieldName/text()');
fD = this.xpathQuery('fieldDesc/text()');
debug.write(fN);
var foo = new dynField(v_contacts, {width:50,
x:parent.x +50, y:parent.y+50+i,
name:fN,
fN:fN,
fD:fD} );
}while (this.selectnext());
</method>
</datapointer>
My goal is to read an XML file that contains the label,name and datapath of the nessecary input boxes.
Using the code below I've been able to create the input boxes and assign them a proper datapath. However it appears that since they are created dynamically they do not follow the layout rules of the view I am placing them in. Or they are not being placed inside the target view at all.
I could write a script to manually provide x & y values as I create the objects, however I'm wondering if there is a better way. My main concern is that I would like to wrap this up as a class and place it inside a larger application. Therefore if the x & y coordinates are relative to the canvas and not the class view I would be overlapping items.
Secondly I'm wondering how this method compares performance wise, to generating the LZX on the fly using Coldfusion or PHP. Rather than having the LZX dynamically create the objects.
Thanks for the assistance
Here's the important snippets....
<dataset name="fields" >
<nodes>
<field>
<fieldName>phWork1</fieldName>
<fieldDesc>Work 1</fieldDesc>
</field>
<field>
<fieldName>phWork2</fieldName>
<fieldDesc>Work 2</fieldDesc>
</field>
</nodes>
</dataset>
<class name="dynField" >
<attribute type="string" name="fN" />
<attribute type="string" name="fD" />
<simplelayout axis="x" />
<text name="label" text="${parent.fD}" />
<etPhone name="phone" datapath="${'dset:/contacts/contact/phones/'+ parent.fN +'/text()'}" />
</class>
<datapointer name="dp_fields" xpath="fields:/" ondata="printData()">
<method name="printData">
this.selectChild(2)
var i = 50;
do{
i = i + 50;
fN = this.xpathQuery('fieldName/text()');
fD = this.xpathQuery('fieldDesc/text()');
debug.write(fN);
var foo = new dynField(v_contacts, {width:50,
x:parent.x +50, y:parent.y+50+i,
name:fN,
fN:fN,
fD:fD} );
}while (this.selectnext());
</method>
</datapointer>