You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Yatin Shah <no...@kripa.com> on 2003/04/22 23:46:34 UTC

XMLForm & JavaScript incompatibility

JavaScript incompatibility results when using
XMLForm with a xf:group option or when the
ref argument refers to a name containing the slash character('/').

This becomes an issue if one desires to use javascript features
to access and manipulate the state of input fields.
In the example below, '/activityForm/DBdata/startDate' is an 
invalid JavaScript name.[Although, it's a proper jxpath name!]

Apurva zaveri [1] had a similar issue. Does anyone know
how to get around this problem?


SAMPLE XMLFORM code
-------------------

<xf:group ref="/activityForm/DBdata">
    <xf:textbox ref="startTime">
      <xf:caption>Start Time</xf:caption>
      <xf:violations class="error"/>
    </xf:textbox>
</xf:group>

Resulting HTML
--------------

<input name="/activityForm/DBdata/startDate" type="textbox" value="2002-09-23">


[1]: http://marc.theaimsgroup.com/?l=xml-cocoon-users&w=2&r=1&s=xmlform+JavaScript&q=b


-- 
Yatin Shah, President                       mailto:ygs@kripa.com
Kripa Inc.                                  http://www.kripa.com
Dayton, New Jersey USA                      phone:  732.329.8303
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Developers of real time event driven distributed DB application



Re: XMLForm & JavaScript incompatibility

Posted by Konstantin Piroumian <kp...@apache.org>.
Use this:

document.forms[0].elements["/root/field"];

or this (if you set the 'id' attribute):

document.getElementById("/root/field");

--
  Konstantin

From: "Yatin Shah" <no...@kripa.com>

> JavaScript incompatibility results when using
> XMLForm with a xf:group option or when the
> ref argument refers to a name containing the slash character('/').
>
> This becomes an issue if one desires to use javascript features
> to access and manipulate the state of input fields.
> In the example below, '/activityForm/DBdata/startDate' is an
> invalid JavaScript name.[Although, it's a proper jxpath name!]
>
> Apurva zaveri [1] had a similar issue. Does anyone know
> how to get around this problem?
>
>
> SAMPLE XMLFORM code
> -------------------
>
> <xf:group ref="/activityForm/DBdata">
>     <xf:textbox ref="startTime">
>       <xf:caption>Start Time</xf:caption>
>       <xf:violations class="error"/>
>     </xf:textbox>
> </xf:group>
>
> Resulting HTML
> --------------
>
> <input name="/activityForm/DBdata/startDate" type="textbox"
value="2002-09-23">
>
>
> [1]:
http://marc.theaimsgroup.com/?l=xml-cocoon-users&w=2&r=1&s=xmlform+JavaScrip
t&q=b
>
>
> --
> Yatin Shah, President                       mailto:ygs@kripa.com
> Kripa Inc.                                  http://www.kripa.com
> Dayton, New Jersey USA                      phone:  732.329.8303
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Developers of real time event driven distributed DB application
>
>
>


Re: XMLForm & JavaScript incompatibility

Posted by ivelin <iv...@apache.org>.
Would it not work if you use the alternative JS syntax

form.field['/activityForm/DBdata/startDate'].value = "10/03/2003"



-=Ivelin=-
----- Original Message -----
From: "Yatin Shah" <no...@kripa.com>
To: <co...@xml.apache.org>
Sent: Tuesday, April 22, 2003 4:46 PM
Subject: XMLForm & JavaScript incompatibility


> JavaScript incompatibility results when using
> XMLForm with a xf:group option or when the
> ref argument refers to a name containing the slash character('/').
>
> This becomes an issue if one desires to use javascript features
> to access and manipulate the state of input fields.
> In the example below, '/activityForm/DBdata/startDate' is an
> invalid JavaScript name.[Although, it's a proper jxpath name!]
>
> Apurva zaveri [1] had a similar issue. Does anyone know
> how to get around this problem?
>
>
> SAMPLE XMLFORM code
> -------------------
>
> <xf:group ref="/activityForm/DBdata">
>     <xf:textbox ref="startTime">
>       <xf:caption>Start Time</xf:caption>
>       <xf:violations class="error"/>
>     </xf:textbox>
> </xf:group>
>
> Resulting HTML
> --------------
>
> <input name="/activityForm/DBdata/startDate" type="textbox"
value="2002-09-23">
>
>
> [1]:
http://marc.theaimsgroup.com/?l=xml-cocoon-users&w=2&r=1&s=xmlform+JavaScrip
t&q=b
>
>
> --
> Yatin Shah, President                       mailto:ygs@kripa.com
> Kripa Inc.                                  http://www.kripa.com
> Dayton, New Jersey USA                      phone:  732.329.8303
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Developers of real time event driven distributed DB application
>