You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Chandra Sekharan Bhaskaran <ch...@wipro.com> on 2002/08/15 20:37:21 UTC
dynamically Passing values to Javascript function
I have submit button in the iterate tag
I need to pass the parameter <bean:write name="companionInfo"
property="companionArticleNumber" />",this)
to deletescript and it gives me parsing error.
any one had worked on this pls let me know
rgds
C.Bhaskaran
<html:submit property="delete" onclick="deletescript("<bean:write
name="companionInfo" property="companionArticleNumber" />",this)"
styleId="formbuttons" />
<bean:message
key="labels.buttons.msmetadata.companion.deleteCompanion" />
</html:submit>
Re: dynamically Passing values to Javascript function
Posted by Danny Mui <da...@muibros.com>.
You can't embed a tag within a tag. That's not JSP compliant I believe.
What I've done in the past is:
<bean:define id="articleNumber" name="companionInfo"
property="companionArticleNumber" />
<html:submit property="delete" onclick="deletescript('<%= articleNumber
%>', this)" styleId="formbuttons" />
I've had problems passing in the args as above before, it could appear as:
deletescript('<%= articleNumber %>', this)
I'm not sure if that was fixed in the nightly builds but that was the
case in 1.1beta1. My workaround was to wrap the hole js function in to
a variable and it worked properly.
danny
Chandra Sekharan Bhaskaran wrote:
> I have submit button in the iterate tag
> I need to pass the parameter <bean:write name="companionInfo"
> property="companionArticleNumber" />",this)
> to deletescript and it gives me parsing error.
> any one had worked on this pls let me know
> rgds
> C.Bhaskaran
>
> <html:submit property="delete" onclick="deletescript("<bean:write
> name="companionInfo" property="companionArticleNumber" />",this)"
> styleId="formbuttons" />
> <bean:message
> key="labels.buttons.msmetadata.companion.deleteCompanion" />
> </html:submit>
>
>------------------------------------------------------------------------
>
>**************************Disclaimer************************************
>
>
>Information contained in this E-MAIL being proprietary to Wipro Limited
>is 'privileged' and 'confidential' and intended for use only by the
>individual or entity to which it is addressed. You are notified that any
>use, copying or dissemination of the information contained in the E-MAIL
>in any manner whatsoever is strictly prohibited.
>
>
>*****************************************************************************
>
>
>
>------------------------------------------------------------------------
>
>--
>To unsubscribe, e-mail: <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: dynamically Passing values to Javascript function
Posted by Troy Hart <th...@part.net>.
On Thu, 2002-08-15 at 12:58, Troy Hart wrote:
> On Thu, 2002-08-15 at 12:37, Chandra Sekharan Bhaskaran wrote:
> > I have submit button in the iterate tag
> > I need to pass the parameter <bean:write name="companionInfo"
> > property="companionArticleNumber" />",this)
> > to deletescript and it gives me parsing error.
> > any one had worked on this pls let me know
> > rgds
> > C.Bhaskaran
> >
> > <html:submit property="delete" onclick="deletescript("<bean:write
> > name="companionInfo" property="companionArticleNumber" />",this)"
> > styleId="formbuttons" />
> > <bean:message
> > key="labels.buttons.msmetadata.companion.deleteCompanion" />
> > </html:submit>
> > ----
> >
>
> You can not embed the the <bean:write> tag inside <html:submit> tag. The
> following is one alternative:
>
> <html:submit property="delete"
> onclick="deletescript('<%=companionInfo.getCompanionArticleNumber()%>',this)" styleId="formbuttons">
> <bean:message
> key="labels.buttons.msmetadata.companion.deleteCompanion"/>
> </html:submit>
It seems like I may have had trouble with something similar to this
before (that is my proposed solution to your problem). If you find the
same thing, you can also try the following:
<%
StringBuffer deleteSubmitOnClick = new StringBuffer("deletescript('");
deleteSubmitOnClick.append(companionInfo.getCompanionArticleNumber());
deleteSubmitOnClick.append("', this)");
%>
<html:submit property="delete"
onclick="<%=deleteSubmitOnClick.toString()%>" styleId="formbuttons">
<bean:message
key="labels.buttons.msmetadata.companion.deleteCompanion"/>
</html:submit>
Or, I'm sure there are other ideas...
Good Luck,
Troy
>
> Troy
>
> > **************************Disclaimer************************************
> >
> >
> > Information contained in this E-MAIL being proprietary to Wipro Limited
> > is 'privileged' and 'confidential' and intended for use only by the
> > individual or entity to which it is addressed. You are notified that any
> > use, copying or dissemination of the information contained in the E-MAIL
> > in any manner whatsoever is strictly prohibited.
> >
> >
> > *****************************************************************************
> >
> > ----
> >
>
> > --
> > To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> > For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: dynamically Passing values to Javascript function
Posted by Troy Hart <th...@part.net>.
On Thu, 2002-08-15 at 12:37, Chandra Sekharan Bhaskaran wrote:
> I have submit button in the iterate tag
> I need to pass the parameter <bean:write name="companionInfo"
> property="companionArticleNumber" />",this)
> to deletescript and it gives me parsing error.
> any one had worked on this pls let me know
> rgds
> C.Bhaskaran
>
> <html:submit property="delete" onclick="deletescript("<bean:write
> name="companionInfo" property="companionArticleNumber" />",this)"
> styleId="formbuttons" />
> <bean:message
> key="labels.buttons.msmetadata.companion.deleteCompanion" />
> </html:submit>
> ----
>
You can not embed the the <bean:write> tag inside <html:submit> tag. The
following is one alternative:
<html:submit property="delete"
onclick="deletescript('<%=companionInfo.getCompanionArticleNumber()%>',this)" styleId="formbuttons">
<bean:message
key="labels.buttons.msmetadata.companion.deleteCompanion"/>
</html:submit>
Troy
> **************************Disclaimer************************************
>
>
> Information contained in this E-MAIL being proprietary to Wipro Limited
> is 'privileged' and 'confidential' and intended for use only by the
> individual or entity to which it is addressed. You are notified that any
> use, copying or dissemination of the information contained in the E-MAIL
> in any manner whatsoever is strictly prohibited.
>
>
> *****************************************************************************
>
> ----
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>