Shoukat,
Basically you need to understand that you are using a scriptlet code -
It is an expression <%= %>. See JSP expression. What ever is the
output of it, it will just be written.
If you get this point, then you will be able to pass the value.
javascript:calculate('<%=((yourObject)benefits.get(index.intValue())).value();%>',..)
index.IntValue - I am not sure where you index exists - so appropriately
substitue for index.intValue
Basically it is a scriplet code. This should give you an idea.
see a very lame example here
http://www.roseindia.net/jsp/jsp_date_example.shtml
Thanks,
Vijay Venkataraman
Shoukat, Faisal wrote:
Unfortuately as before it just prints out benefits[index.intValue()].value
and not the actual value.
-----Original Message-----
From: siva sajja [mailto:[EMAIL PROTECTED]
Sent: 04 May 2006 15:12
To: Struts Users Mailing List
Subject: Re: [OT] calling js function with list backed form value
Hi
Try replacing the code
javascript:calculate('<%="benefits[" + index.intValue() +
"].value"%>',....... with
javascript:calculate('<%= benefits[index.intValue()].value%>',... (removing
the string concatenation)
Hope this will help
Cheers,
Siva.
On 5/4/06, Shoukat, Faisal <[EMAIL PROTECTED]> wrote:
If I use the html; text property the only diff would be
<html:text property="<%="benefits["+index.intValue()+"].value"%>"
size="20"
onblur="<%=jsFunction%>"/>
I still have the same problem. If I put this in then the value becomes
[object]
Thanks
-----Original Message-----
From: vijay venkataraman [mailto:[EMAIL PROTECTED]
Sent: 04 May 2006 13:12
To: Struts Users Mailing List
Subject: Re:[OT] calling js function with list backed form value
In your JS function can you add 'this' as one of the parameter. Then in
your js function you can get the value from the element.
Like <input type="text" onclick="return someFunction(this)"/> which
implies the element on which the event occured.
Note: I have never used <bean:xxx tags> and don't know much about it.
My thoughts.
Thanks,
Vijay Venkataraman
Shoukat, Faisal wrote:
Hi,
I have a list backed action form and want to call a javascript function
with
one of the parameters to the function being a value from the list backed
action form.
My js function is as such:
<bean:define id="jsFunction">
javascript:calculate('<%="benefits[" + index.intValue() + "].value"%>',
'<bean:write name="benefit"
property="benMaxRange"/>',
'<bean:write name="benefit"
property="benMinRange"/>',
'<bean:write name="benefit" property="benRange"/>',
'<bean:write name="benefit" property="label"/>')
</bean:define>
The value I want substituted into the function is <%="benefits[" +
index.intValue() + "].value"%>
My input text tag is as such which calls the function:
<input type="text" name="<%="benefit["+index.intValue()+"].value"%>"
value="" size="20" onblur="<%=jsFunction%>"/>
Can anyone help with explaining how to get the value from the input text
box
of the form and send it to the function. The text boxes name is dynamic
thus
causes me problems.
The html source shows the following: benefit[0].value in the function and
not the actual value.
Thanks
------------------------------DISCLAIMER------------------------------
This message is for the named person's use only. It may contain
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission.
If you receive this message in error, please immediately delete it and
all copies of it from your system, destroy any hard copies of it and
notify the sender. You must not, directly or indirectly, use, disclose,
distribute, print, or copy any part of this message if you are not the
intended recipient.
Lisle Technology Partners Pvt. Ltd. and any of its subsidiaries each
reserve the right to monitor all e-mail communications through its
networks.
Any views expressed in this message are those of the
individual sender, except where the message states otherwise and the
sender is authorized to state them to be the views of any such entity.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]