You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Alawadhi, Mona" <ma...@kpmg.com> on 2003/06/03 17:49:50 UTC

taglibs - nonstatic javascript value


yes, it worked.

I have one problem, though: passing dynamic value to the function I call in
javascript.

This is what I have:
	<logic:iterate name="addressListFormBean" id="choice"
property="letterOptions">
       	<html:link  href="javascript:setHiddenLetter('D');
document.forms[0].submit(); ">
       		<bean:write name="choice" property="labelStr"/>
       	</html:link>
       </logic:iterate>

I would like to replace that 'D' with something like <%=choice%>, for the
user to be able to select the letter (there are letter A through Z, and
'letter' is a hidden field).

How can I do that?

Mona 

-----Original Message-----
From: Lynn Guy [mailto:lguy01@yahoo.com]
Sent: Monday, June 02, 2003 4:35 PM
To: Struts Users Mailing List
Subject: RE: first time action


put them in an html form tag
then in your link do something like
onclick=this.submit()
<script>
function doInsert() {
         document.forms[0].submit();
}
</script>

  <html:form action="assetWorksheet.do" method="post"
>
    <a href="javascript:doInsert()">        
      <html:img srcKey="image.button.createIncome"</a>
   </html:form>

I think the name property for the html:form tag is no
longer valid so forms[0] refers to the first form on
my page.

In your case you can probably use the html:link tag
and put the javascript call in the onclick property.

hth


*****************************************************************************
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorized. 

If you are not the intended recipient, any disclosure, copying, distribution
or any action taken or omitted to be taken in reliance on it, is prohibited
and may be unlawful. When addressed to our clients any opinions or advice
contained in this email are subject to the terms and conditions expressed in
the governing KPMG client engagement letter.         
*****************************************************************************


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


RE: taglibs - nonstatic javascript value

Posted by Varun Garg <va...@yahoo.com>.
I would just put a bean:write instead on the D.


	<logic:iterate name="addressListFormBean" id="choice"
property="letterOptions">
       	<html:link  href="javascript:setHiddenLetter('"<bean:write
name="choice" property="labelStr"/>"');
document.forms[0].submit(); ">
       		<bean:write name="choice" property="labelStr"/>
       	</html:link>
       </logic:iterate>
-----Original Message-----
From: Alawadhi, Mona [mailto:malawadhi@kpmg.com] 
Sent: Tuesday, June 03, 2003 10:50 AM
To: 'Struts Users Mailing List'
Subject: taglibs - nonstatic javascript value




yes, it worked.

I have one problem, though: passing dynamic value to the function I call
in javascript.

This is what I have:
	<logic:iterate name="addressListFormBean" id="choice"
property="letterOptions">
       	<html:link  href="javascript:setHiddenLetter('D');
document.forms[0].submit(); ">
       		<bean:write name="choice" property="labelStr"/>
       	</html:link>
       </logic:iterate>

I would like to replace that 'D' with something like <%=choice%>, for
the user to be able to select the letter (there are letter A through Z,
and 'letter' is a hidden field).

How can I do that?

Mona 

-----Original Message-----
From: Lynn Guy [mailto:lguy01@yahoo.com]
Sent: Monday, June 02, 2003 4:35 PM
To: Struts Users Mailing List
Subject: RE: first time action


put them in an html form tag
then in your link do something like
onclick=this.submit()
<script>
function doInsert() {
         document.forms[0].submit();
}
</script>

  <html:form action="assetWorksheet.do" method="post"
>
    <a href="javascript:doInsert()">        
      <html:img srcKey="image.button.createIncome"</a>
   </html:form>

I think the name property for the html:form tag is no
longer valid so forms[0] refers to the first form on
my page.

In your case you can probably use the html:link tag
and put the javascript call in the onclick property.

hth


************************************************************************
*****
The information in this email is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this
email by anyone else is unauthorized. 

If you are not the intended recipient, any disclosure, copying,
distribution or any action taken or omitted to be taken in reliance on
it, is prohibited and may be unlawful. When addressed to our clients any
opinions or advice contained in this email are subject to the terms and
conditions expressed in
the governing KPMG client engagement letter.         
************************************************************************
*****


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



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