Hi Henrik,
i'm trying to understand what you're trying to do, but if you want to load the
value in the upload field widget from the XML I'm afraid I will have to
dissapoint you. Due to security reasons browsers will not allow you to fill in
the value of any upload field.
Regards,
Jeroen Reijn
-----Oorspronkelijk bericht-----
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Verzonden: wo 7-3-2007 14:42
Aan: [email protected]
CC:
Onderwerp: Hiding fields according to data.xml entry
Hello,
I need some help with cocoon 2.1.10 and cforms.
I am looking for a way to show or hide upload fields (including their
label) according to a list of values loaded from a xml file.
Concrete:
When selecting a documenttype from a combobox I need the system to show
a list of upload fields which is defined in the datafile.
<doctypes>
<doctype name="first">
<uploadfield type="xml"/>
<uploadfield type="doc"/>
<uploadfield type="pdf"/>
</doctype>
<doctype name="second">
<uploadfield type="doc"/>
<uploadfield type="pdf"/>
</doctype>
</doctypes>
When the doctype "first" is selected from the combobox, the
uploadfields for xml, doc and pdf have to appear on the screen. If "second" is
selected only doc and pdf should be shown.
I am able to hide and show the fields if any value is selected or not
with the following script within my formdefinition. I am also able to fill the
document combobox from the data.xml file. but I do not know what to to to load
the uploadfield-values from the data.xml file and react accordingly.
Any help would be greatly appreciated.
Henrik
<fd:field id="document" required="false" state="disabled">
<fd:label>Document</fd:label>
<fd:datatype base="string"/>
<fd:selection-list>
<fd:item value="">
<fd:label>Select a Document</fd:label>
</fd:item>
</fd:selection-list>
<fd:on-value-changed>
<fd:javascript>
var value = event.newValue;
if (value != null) {
this.lookupWidget("../pdf").state =
Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE;
this.lookupWidget("../doc").state =
Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE;
this.lookupWidget("../xml").state =
Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE;
} else {
this.lookupWidget("../pdf").state =
Packages.org.apache.cocoon.forms.formmodel.WidgetState.INVISIBLE;
this.lookupWidget("../doc").state =
Packages.org.apache.cocoon.forms.formmodel.WidgetState.INVISIBLE;
this.lookupWidget("../xml").state =
Packages.org.apache.cocoon.forms.formmodel.WidgetState.INVISIBLE;
}
</fd:javascript>
</fd:on-value-changed>
</fd:field>
--
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: www.gmx.net/de/go/mailfooter/topmail-out
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]