You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by ha...@gmx.net on 2007/03/07 14:42:27 UTC

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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


XML Transforms and namespaceURI

Posted by "Schmitz, Jeffrey A" <Je...@boeing.com>.
This is hopefully a very simple question.  I'm trying to figure out the
whole namespace concept as it applies to a custom transformation.  For
my xml data, I don't use namespaces, and I don't want any filtering on
any namespace, i.e. I want to process all the data in the xml file.  For
this situation, what do I set the namespaceURI string to in my custom
transformer, and what is the best way to set the string? 

Also, what would the format be if I actually want to filter on some
namespace?  I have read the following form the source code, but an
example would be very nice.

* <h3>Namespace handling</h3>
 * By setting the instance variable namespaceURI to the namespace the
 * events are filtered and only events with this namespace are send to
 * the two hooks: <code>startTransformingElement</code> and
 * <code>endTransformingElement</code>. It is possible to override the
default
 * namespace for the transformer by specifying the parameter
"namespaceURI"
 * in the pipeline. This avoids possible namespace collisions.

/**
     * The namespace used by the transformer for the SAX events
filtering.
     * This either equals to the {@link #defaultNamespaceURI} or to the
value
     * set by the <code>namespaceURI</code> sitemap parameter for the
pipeline.
     * Must never be null.
     */

Thanks,
Jeff

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Hiding fields according to data.xml entry

Posted by Grzegorz Kossakowski <gr...@tuffmail.com>.
hap2000@gmx.net napisał(a):
> Hey Grzegorz,
>
> if I get you right, I would have to build a form definition for any possible combination of upload fields (which is not so much) and create according pipes.
> This sound like a good attempt, but how do decide, which pipe to take? I still need the extra information from the data.xml and I need to process it to find out, which fields to show or which form to use. I am still not clear about, how I can do that.
>
>   

it should look like:
<map:matcher pattern="buildFormDefinition">
  <map:generate src="data.xml"/>
  <map:transform type="xslt" src="buildFormDefinition.xsl">
     <map:parameter name="doctype" value="{request-param:doctype}"/>
  </map:transform>
  <map:serialize type="xml"/>
</map:matcher>

This way you could pass selected doctype as request parameter
(buildFormDefinition?doctype=blablah) and build a form definition from
the data in data.xml file.

I hope this clarifies a little bit.

-- 
Grzegorz Kossakowski

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Hiding fields according to data.xml entry

Posted by ha...@gmx.net.
Hey Grzegorz,

if I get you right, I would have to build a form definition for any possible combination of upload fields (which is not so much) and create according pipes.
This sound like a good attempt, but how do decide, which pipe to take? I still need the extra information from the data.xml and I need to process it to find out, which fields to show or which form to use. I am still not clear about, how I can do that.

greetings,
Henrik

-------- Original-Nachricht --------
Datum: Wed, 07 Mar 2007 16:15:44 +0100
Von: Grzegorz Kossakowski <gr...@tuffmail.com>
An: users@cocoon.apache.org
CC: 
Betreff: Re: Hiding fields according to data.xml entry

> hap2000@gmx.net napisał(a):
> > 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.
> >   
> Instead of hiding particular widgets I would just build form definition 
> based on user's selection. Basically you have to build a pipeline that 
> will generate form definition and form template based on user's choice. 
> If you need further help/advice just ask.
> 
> -- 
> Grzegorz Kossakowski
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org

-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Hiding fields according to data.xml entry

Posted by Grzegorz Kossakowski <gr...@tuffmail.com>.
hap2000@gmx.net napisał(a):
> 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.
>   
Instead of hiding particular widgets I would just build form definition 
based on user's selection. Basically you have to build a pipeline that 
will generate form definition and form template based on user's choice. 
If you need further help/advice just ask.

-- 
Grzegorz Kossakowski

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: RE: Hiding fields according to data.xml entry

Posted by Jeroen Reijn <j....@hippo.nl>.
Henrik,

aha! Since you are using Cocoon Forms, have you considered using the union widget? http://cocoon.apache.org/2.1/userdocs/widgets/widget_union.html

I think this does exactly what you want.

Kind regards,

Jeroen Reijn


-----Original Message-----
From:	hap2000@gmx.net [mailto:hap2000@gmx.net]
Sent:	Wed 7-3-2007 16:16
To:	users@cocoon.apache.org
Cc:	
Subject:	Re: RE: Hiding fields according to data.xml entry

Hi Jeroen,

I do not want to load any value into the upload field.

My goal is to display only the upload fields allowed for this document type. The dependency between document and shown upload fields is defined in the data.xml file.

greetings,
Henrik


-------- Original-Nachricht --------
Datum: Wed, 7 Mar 2007 15:07:41 +0100
Von: "Jeroen Reijn" <j....@hippo.nl>
An: users@cocoon.apache.org, users@cocoon.apache.org
CC: 
Betreff: RE: Hiding fields according to data.xml entry

> 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: hap2000@gmx.net [mailto:hap2000@gmx.net] 
> 	Verzonden: wo 7-3-2007 14:42 
> 	Aan: users@cocoon.apache.org 
> 	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: users-unsubscribe@cocoon.apache.org
> 	For additional commands, e-mail: users-help@cocoon.apache.org
> 	
> 	
> 

-- 
"Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
Jetzt GMX ProMail testen: www.gmx.net/de/go/mailfooter/promail-out

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: RE: Hiding fields according to data.xml entry

Posted by ha...@gmx.net.
Hi Jeroen,

I do not want to load any value into the upload field.

My goal is to display only the upload fields allowed for this document type. The dependency between document and shown upload fields is defined in the data.xml file.

greetings,
Henrik


-------- Original-Nachricht --------
Datum: Wed, 7 Mar 2007 15:07:41 +0100
Von: "Jeroen Reijn" <j....@hippo.nl>
An: users@cocoon.apache.org, users@cocoon.apache.org
CC: 
Betreff: RE: Hiding fields according to data.xml entry

> 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: hap2000@gmx.net [mailto:hap2000@gmx.net] 
> 	Verzonden: wo 7-3-2007 14:42 
> 	Aan: users@cocoon.apache.org 
> 	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: users-unsubscribe@cocoon.apache.org
> 	For additional commands, e-mail: users-help@cocoon.apache.org
> 	
> 	
> 

-- 
"Feel free" - 5 GB Mailbox, 50 FreeSMS/Monat ...
Jetzt GMX ProMail testen: www.gmx.net/de/go/mailfooter/promail-out

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: Hiding fields according to data.xml entry

Posted by Jeroen Reijn <j....@hippo.nl>.
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: hap2000@gmx.net [mailto:hap2000@gmx.net] 
	Verzonden: wo 7-3-2007 14:42 
	Aan: users@cocoon.apache.org 
	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: users-unsubscribe@cocoon.apache.org
	For additional commands, e-mail: users-help@cocoon.apache.org