It was much simpler than I thought.
To create a hidden field
Instead of $doc.display('propertyName') do
<input type="hidden" name="my.class_0_propertyName"
value="">
To add an attribute to an element
#set($tmpUMLtext="")
#set($added=0)
#foreach($part in
$!$doc.display('propertyName').split("id='my.class_0_propertyName'"))
#set($tmpUMLtext = $tmpUMLtext + " " + $part)
#if($added==0)
#set($tmpUMLtext = $tmpUMLtext + "id='my.class_0_propertyName'
onChange=")
#set($tmpUMLtext = $tmpUMLtext + '"setFormElvalue(')
#set($tmpUMLtext = $tmpUMLtext + "'my.class_0_propertyName',1)")
#set($tmpUMLtext = $tmpUMLtext + '"')
#set($added=1)
#end
#end
$tmpUMLtext
Ajdin
-----Original Message-----
From: users-bounces(a)xwiki.org [mailto:users-bounces@xwiki.org] On Behalf
Of Jerome Velociter
Sent: 20 February 2009 13:12
To: XWiki Users
Subject: Re: [xwiki-users] adding attribute to form field
Hi Adjin,
You probably want to do that the non obstrusive way. You can use
prototype's Element.observe for this. See
http://www.prototypejs.org/api/element/observe
$('elementid').observe('change', yourFunction);
or
$$('cssLocator')[x].observe('change', yourFunction);
Hope this helps,
Jerome
Ajdin Brandic wrote:
Hi
Has anyone tried to add a new attribute to a form field created when
document in edit (inline) mode?
I want to add onChange="somejs" to <textarea>
ajdin
--------------------------------------------------------
NOTICE
This message and any files transmitted with it is intended for the
addressee only
and may contain information that is confidential or
privileged. Unauthorised use is strictly prohibited. If you are not the
addressee, you should not read, copy, disclose or otherwise use this
message, except for the purpose of delivery to the addressee.
Any views or opinions expressed within this e-mail are those of the
author and do
not necessarily represent those of Coventry University.
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users