Re: Pass parameter to javascript function
I tried with all the suggestions but it doesn't work: Does anybody know the problem? My code is: logic:iterate id=lista name=busquedaproveedorForm property=lstResultado html:radio idName=lista onclick=setBusquedaProveedor(${idProveedor},${strRazonSocial}) property=idProveedor value=idProveedor / /logic:iterate I try to pass idProveedor and strRazonSocial to a javascript function... But it doesn't work. I tried with lista.idProveedor but nothing... Do u know the correct declaration??? Thanks -- Rafael Taboada Software Engineer Cell : +511-97753290 No creo en el destino pues no me gusta tener la idea de controlar mi vida
Re: Pass parameter to javascript function
Hope you are getting the values (see the source on your page and find out) The reason JavaScript doesn't work is that the value of idProveedor is a string which is not declared. So it should work if you give the same within quotes. Try... html:radio idName=lista onclick=setBusquedaProveedor('${idProveedor}','${strRazonSocial}') property=idProveedor value=idProveedor / or html:radio idName=lista onclick=setBusquedaProveedor(\${idProveedor}\,\${strRazonSocial}\) property=idProveedor value=idProveedor / HTH Nitesh - Original Message - From: Rafael Taboada [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, June 16, 2005 11:55 AM Subject: Re: Pass parameter to javascript function I tried with all the suggestions but it doesn't work: Does anybody know the problem? My code is: logic:iterate id=lista name=busquedaproveedorForm property=lstResultado html:radio idName=lista onclick=setBusquedaProveedor(${idProveedor},${strRazonSocial}) property=idProveedor value=idProveedor / /logic:iterate I try to pass idProveedor and strRazonSocial to a javascript function... But it doesn't work. I tried with lista.idProveedor but nothing... Do u know the correct declaration??? Thanks -- Rafael Taboada Software Engineer Cell : +511-97753290 No creo en el destino pues no me gusta tener la idea de controlar mi vida - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Pass parameter to javascript function
Hi, it doesn't work. I saw the source and it takes ${idProveedor} as a String input type=radio name=idProveedor value=1 onclick=setBusquedaProveedor(${idProveedor},${strRazonSocial}) input type=radio name=idProveedor value=1 onclick=setBusquedaProveedor('${idProveedor}','${strRazonSocial}') If u see value=1 The query and getting data work fine... But passing parameter to a javascript function doesn't work why??? My entire code is: logic:present name=busquedaproveedorForm property=lstResultado bean:size id=size name=busquedaproveedorForm property=lstResultado / logic:greaterThan name=size value=0 logic:iterate id=lista name=busquedaproveedorForm property=lstResultado tr class=FilaImpar td html:radio idName=lista onclick=setBusquedaProveedor('${idProveedor}','${strRazonSocial}') property=idProveedor value=idProveedor / /td td class=IndentLeftValor de idProveedor: ${contador} bean:write name=lista property=strRazonSocial //td td class=Centerbean:write name=lista property=strRUC //td /tr /logic:iterate /logic:greaterThan /logic:present What's wrong with my code??? Thanks in advance -- Rafael Taboada Software Engineer Cell : +511-97753290 No creo en el destino pues no me gusta tener la idea de controlar mi vida
Re: Pass parameter to javascript function
Finally I found a desesperated solution :'( input type='radio' name='idProveedor' value='bean:write name=lista property=idProveedor/' onclick='javascript:setBusquedaProveedor(bean:write name=lista property=idProveedor/,bean:write name=lista property=strRazonSocial /)' But what happend with html:radio??? Why doesn't work if I use html:radio instead of input type='radio' Please... Could u share ur xperiencie in this kind of problem??? Thanks -- Rafael Taboada Software Engineer Cell : +511-97753290 No creo en el destino pues no me gusta tener la idea de controlar mi vida
Re: Pass parameter to javascript function
Shot in the dark, try this: html:radio idName='lista' onclick='setBusquedaProveedor(${idProveedor},${strRazonSocial})' property='idProveedor' value='idProveedor' / - Original Message - From: Rafael Taboada [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, June 16, 2005 10:18 AM Subject: Re: Pass parameter to javascript function Finally I found a desesperated solution :'( input type='radio' name='idProveedor' value='bean:write name=lista property=idProveedor/' onclick='javascript:setBusquedaProveedor(bean:write name=lista property=idProveedor/,bean:write name=lista property=strRazonSocial /)' But what happend with html:radio??? Why doesn't work if I use html:radio instead of input type='radio' Please... Could u share ur xperiencie in this kind of problem??? Thanks -- Rafael Taboada Software Engineer Cell : +511-97753290 No creo en el destino pues no me gusta tener la idea de controlar mi vida - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Pass parameter to javascript function
Thank u very much for all ur help... Zarar: the same thing, it takes as String value In my code: html:radio idName='lista' onclick='setBusquedaProveedor(${idProveedor},${strRazonSocial})' property='idProveedor' value='idProveedor' / In the source code(runtime): input type=radio name=idProveedor value=1 onclick=setBusquedaProveedor(${idProveedor},${strRazonSocial}) -- Rafael Taboada Software Engineer Cell : +511-97753290 No creo en el destino pues no me gusta tener la idea de controlar mi vida
Re: Pass parameter to javascript function
Did you try using the expression tags... that may work. (you may need to change the methods to the right ones...) html:radio idName='lista' onclick='setBusquedaProveedor(%= lista.getIdProveedor() %,%= lista.getStrRazonSocial() %)' property='idProveedor' value='idProveedor' / The bean:write would not work in html:radio since the tag doesn't allow/recognize nested tags. Nitesh - Original Message - From: Rafael Taboada [EMAIL PROTECTED] Cc: Struts Users Mailing List user@struts.apache.org Sent: Thursday, June 16, 2005 8:35 PM Subject: Re: Pass parameter to javascript function Thank u very much for all ur help... Zarar: the same thing, it takes as String value In my code: html:radio idName='lista' onclick='setBusquedaProveedor(${idProveedor},${strRazonSocial})' property='idProveedor' value='idProveedor' / In the source code(runtime): input type=radio name=idProveedor value=1 onclick=setBusquedaProveedor(${idProveedor},${strRazonSocial}) -- Rafael Taboada Software Engineer Cell : +511-97753290 No creo en el destino pues no me gusta tener la idea de controlar mi vida - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Pass parameter to javascript function
Avjit its not working! Amitava Basak ASE Tata Consultancy Services Limited Mailto: [EMAIL PROTECTED] Website: http://www.tcs.com Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you
Re: Pass parameter to javascript function
Thanks martin, its so simpledidn't click in my mind. Amitava Basak ASE Tata Consultancy Services Limited Mailto: [EMAIL PROTECTED] Website: http://www.tcs.com Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you
Re: Pass parameter to javascript function
On 6/12/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Avjit its not working! As someone else already pointed out on this thread, you can only use the Java expression syntax for an *entire* attribute. You can't use it the way it was shown in Avjit's suggested example for you. It has to be: tag attrName=%=someExpression%/ You can either use scriptlet logic before the tag to build up more complex expressions and assign the final thing into a single variable or do string concatenation inside the %= %. There is also the issue of quoting when you want some string literal to be part of the contatenation inside the expression. In those cases, I typically use a single quote for the outermost delimiters and double quotes for any inner string literals like so: tag attrName='%= var1 + some string literal + var2 %' / I believe it will work either way though. You could also use double quotes for the outermost delimiters and single quotes for any inner string literals. You just can't use the same type of quote character for both inner and outer delimiters. Hope this helps, Van -- - Mike Van Riper [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Pass parameter to javascript function
How can I pass parameter in to a javascript function from a html:text tag?? eg: logic: iterate ... indexId=idx html:text property=x name=y onclick=lfnSomething(%=idx%) / ... ... Amitava Basak ASE Tata Consultancy Services Limited Mailto: [EMAIL PROTECTED] Website: http://www.tcs.com Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you
Re: Pass parameter to javascript function
You can pass the parameters to the javascript as shown underneath by enclosing the %=% in single quotes... logic: iterate ... indexId=idx html:text property=x name=y onclick=lfnSomething('%=idx%','%=idx2%') / Avjit On Thu, 09 Jun 2005 [EMAIL PROTECTED] wrote : How can I pass parameter in to a javascript function from a html:text tag?? eg: logic: iterate ... indexId=idx html:text property=x name=y onclick=lfnSomething(%=idx%) / ... ... Amitava Basak ASE Tata Consultancy Services Limited Mailto: [EMAIL PROTECTED] Website: http://www.tcs.com Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you
Re: Pass parameter to javascript function
Really? IDon't you have to enclose the entire value in one scriptlet expression? Like this: logic: iterate ... indexId=idx html:text property=x name=y onclick='%=lfnSomething( + idx + , + idx2 + )%' / Kjersti |+-- || Avjit Singh Jhajj | || [EMAIL PROTECTED]| || fmail.com | || | || 09/06/2005 14:07| || Please respond to | || Struts Users Mailing | || List | || | |+-- --| | | | To: Struts Users Mailing List user@struts.apache.org | | cc: [EMAIL PROTECTED] | | Subject: Re: Pass parameter to javascript function | --| You can pass the parameters to the javascript as shown underneath by enclosing the %=% in single quotes... logic: iterate ... indexId=idx html:text property=x name=y onclick=lfnSomething('%=idx%',' %=idx2%') / Avjit On Thu, 09 Jun 2005 [EMAIL PROTECTED] wrote : How can I pass parameter in to a javascript function from a html:text tag?? eg: logic: iterate ... indexId=idx html:text property=x name=y onclick=lfnSomething(%=idx%) / ... ... Amitava Basak ASE Tata Consultancy Services Limited Mailto: [EMAIL PROTECTED] Website: http://www.tcs.com Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Pass parameter to javascript function
[EMAIL PROTECTED] a écrit : Really? IDon't you have to enclose the entire value in one scriptlet expression? Like this: logic: iterate ... indexId=idx html:text property=x name=y onclick='%=lfnSomething( + idx + , + idx2 + )%' / You can pass the parameters to the javascript as shown underneath by enclosing the %=% in single quotes... logic: iterate ... indexId=idx html:text property=x name=y onclick=lfnSomething('%=idx%',' %=idx2%') / You can even use the ${} notation if you are using JSP 2.4 (IIRC), like this : logic:iterate ... indexId=idx html:text property=x name=y onclick=lfnSomething('${idx}', '${idx2}')/ -- Stéphane Zuckerman - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Pass parameter to javascript function
Kjerstie et al- I found some browsers require the javascript qualifier e.g. javascript:lfnSomething( instead of just the JavaScript func lfnSomething( God Lykke, Martin- - Original Message - From: [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, June 09, 2005 8:20 AM Subject: Re: Pass parameter to javascript function Really? IDon't you have to enclose the entire value in one scriptlet expression? Like this: logic: iterate ... indexId=idx html:text property=x name=y onclick='%=lfnSomething( + idx + , + idx2 + )%' / Kjersti |+-- || Avjit Singh Jhajj | || [EMAIL PROTECTED]| || fmail.com | || | || 09/06/2005 14:07| || Please respond to | || Struts Users Mailing | || List | || | |+-- --| | | | To: Struts Users Mailing List user@struts.apache.org | | cc: [EMAIL PROTECTED] | | Subject: Re: Pass parameter to javascript function | --| You can pass the parameters to the javascript as shown underneath by enclosing the %=% in single quotes... logic: iterate ... indexId=idx html:text property=x name=y onclick=lfnSomething('%=idx%',' %=idx2%') / Avjit On Thu, 09 Jun 2005 [EMAIL PROTECTED] wrote : How can I pass parameter in to a javascript function from a html:text tag?? eg: logic: iterate ... indexId=idx html:text property=x name=y onclick=lfnSomething(%=idx%) / ... ... Amitava Basak ASE Tata Consultancy Services Limited Mailto: [EMAIL PROTECTED] Website: http://www.tcs.com Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]