You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by minhnguyet <mi...@ichi-corp.jp> on 2005/05/21 05:47:01 UTC

How can we send parameter's value to javascript function ??

Hi all,

I want to send  parameter 's value  to  javascript function  .  When I use  <html : radio as  follow  

<html:radio property="auctionTypeId" value="<%=(String)rId%>" onclick='javascript:whichAuctionType(<%=(String)rId%>);'/>   , 

 the value is not send  and  this is a result in IE   

<input type="radio" name="auctionTypeId" value="1" onclick="javascript:whichAuctionType(<%=(String)rId%>);">        

But when  use <input type="radio " as follow 

 <input type="radio" name="auctionTypeId" value="<%= (String)rId%>" onclick='javascript:whichAuctionType(<%=(String)rId%>);'/> 

everything is work right   :      <input type="radio" name="auctionTypeId" value="1" onclick='javascript:whichAuctionType(1);'/>

. I don't see what is different in html  code .  So , how can we directly send parameter value to javascript using <html:radio/> tag ?

Thanks in advance !



Re: How can we send parameter's value to javascript function ??

Posted by Rick Reumann <st...@reumann.net>.
minhnguyet wrote the following on 5/20/2005 11:47 PM:
> Hi all,
> 
> I want to send  parameter 's value  to  javascript function  .  When
> I use  <html : radio as  follow
> 
> <html:radio property="auctionTypeId" value="<%=(String)rId%>"
> onclick='javascript:whichAuctionType(<%=(String)rId%>);'/>   ,

You should use the html-el tags (if not using JSP2.0 container, 
otherwise the standard html tags will support this)...

<html-el:radio property='auctionTypeId'
onclick='whichAuctionType(${rId})' value='${rId}'/>

(You won't need to cast to String by the way)

-- 
Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How can we send parameter's value to javascript function ??

Posted by Steve Bosman <st...@gmail.com>.
On 5/21/05, Saul Qunming Yuan <yu...@dataanvil.com> wrote:
> Try build the whole javascript function part in scriplet as follows:
> 
> onclick="<%='javascript:whichAuctionType(' + rId + ');'%>">
> 
> in your <html:radio>

I think you mean
onclick='<%="javascript:whichAuctionType(" + rId + ");"%>'>
in my experience containers can get very fussy about the use of
scriptlets inside tags and in particular about the types of quotes.

Steve

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How can we send parameter's value to javascript function ??

Posted by Saul Qunming Yuan <yu...@dataanvil.com>.
Try build the whole javascript function part in scriplet as follows:

onclick="<%='javascript:whichAuctionType(' + rId + ');'%>">

in your <html:radio>


Hope that helps.

Saul




----- Original Message ----- 
From: "minhnguyet" <mi...@ichi-corp.jp>
To: <us...@struts.apache.org>
Sent: Friday, May 20, 2005 10:47 PM
Subject: How can we send parameter's value to javascript function ??


Hi all,

I want to send  parameter 's value  to  javascript function  .  When I use 
<html : radio as  follow

<html:radio property="auctionTypeId" value="<%=(String)rId%>" 
onclick='javascript:whichAuctionType(<%=(String)rId%>);'/>   ,

 the value is not send  and  this is a result in IE

<input type="radio" name="auctionTypeId" value="1" 
onclick="javascript:whichAuctionType(<%=(String)rId%>);">

But when  use <input type="radio " as follow

 <input type="radio" name="auctionTypeId" value="<%= (String)rId%>" 
onclick='javascript:whichAuctionType(<%=(String)rId%>);'/>

everything is work right   :      <input type="radio" name="auctionTypeId" 
value="1" onclick='javascript:whichAuctionType(1);'/>

. I don't see what is different in html  code .  So , how can we directly 
send parameter value to javascript using <html:radio/> tag ?

Thanks in advance !




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org