cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Salvetti <m...@notremanou.net>
Subject Re: CForms: inserting unique node on save
Date Sat, 15 Jan 2005 05:56:21 GMT
I'm not too sure, but i think you need a repeater, you can just trop the 
add and remove buttons in the template and just add a node in the dom 
tree from the flow, before the form is binded.
        
document.getElementsByTagName("params").item(0).appendChild(document.createElement("param");

hope this help

Marc

Andrew MacDonald a écrit :

>Hello,
>I'm using CForms to edit an XML file, but can't figure
>out how to insert a unique node when saving the
>document.
>
>Here is what the default doc looks like:
>==========================
><?xml version="1.0"?>
><tool>
>  <toolDetails>
>    <toolName>tool</toolName>
>    <toolDescription>description</toolDescription>
>    <endpointURL>URL</endpointURL>
>    <serviceURI>URI</serviceURI>
>    <serviceMethod>method</serviceMethod>
>  </toolDetails>
>  <params>
>    <param id="1">
>      <label/>
>      <paramName/>
>      <value/>
>      <soapType/>
>      <defaultValue/>
>      <display/>
>      <listItems>
>        <listItem id="1">
>          <label>preset1</label>
>          <value>preset1</value>
>        </listItem>
>        <listItem id="2">
>          <label>preset2</label>
>          <value>preset2</value>
>        </listItem>
>      </listItems>
>    </param>
>  </params>
></tool>
>====================
>Basically I want to insert a new <param> node (and
>increase the id value for it).  Currently when use the
>form.save(doc) method it overwrites the first <param>.
> I've been trying to specify the last <param> node in
>my binding file but get a "JXPath can only create a
>path if it uses exclusively the child:: and
>attribute:: axes and has no context-dependent
>predicates" error, so I'm assuming something like
>"<fb:value id="label" path="param[last()]/label"/>"
>will not work.
>
>Oh, and although I'm using a repeater for <listItems>
>I can't use that for <params> due to the way the forms
>are set up.
>
>Any help would be greatly appreciated!
>
>Thanks,
>Andrew MacDonald
>
>
>	
>		
>__________________________________ 
>Do you Yahoo!? 
>Yahoo! Mail - You care about security. So do we. 
>http://promotions.yahoo.com/new_mail
>
>---------------------------------------------------------------------
>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


Mime
View raw message