Response at end.

> -----Original Message-----
> From: Wendy Smoak [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, October 16, 2002 10:39 AM
> To: 'Struts Users Mailing List'
> Subject: html:submit with an onclick
> 
> I need to set two form properties when a button is clicked.  
> The following
> works with just the setAction() call, but if I add the 
> setKeyToDelete(), it
> doesn't.  I don't know much about Javascript, though, so I 
> may have this all
> wrong.
> 
> The docs have [RTExpr] with the onclick attribute, so I was 
> hoping it would
> evaluate before calling the function.  But it doesn't even 
> compile as is.
> (Then again, I'm looking at the nightly build docs, but using 
> 1.1.  Has the
> RTExpr functionality been added recently?)
> 
> <html:submit property="submit" 
>               onclick="setAction('Delete Staff');
> setKeyToDelete('<bean:write name="staffMember"/>');"
>            styleClass="deleteButton" titleKey="button.delete.staff" 
>                value="     "/>

You can't nest tags in tag attributes.  You also can't nest quoted strings
with the same quote type.

In my view, you have two alternatives:

Ensure the "staffMember" is a scripting variable, and make the entire
"onclick" value be an rtexprvalue, concatenating the values you need (it has
to be the entire attribute value, not just a portion of it).

And the somewhat more radical position: Use the Struts-EL library.  Then,
this would look like this:

<html-el:submit property="submit"
                onclick="setAction('Delete
Staff');setKeyToDelete('${staffMember}');"
                styleClass="deleteButton" titleKey="button.delete.staff"
value="     "/>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to