RE: html:submit with an onclick

2002-10-16 Thread Wendy Smoak

David wrote:
> And the somewhat more radical position: Use the Struts-EL library.  Then,
> this would look like this:
>  onclick="setAction('Delete
> Staff');setKeyToDelete('${staffMember}');"
> styleClass="deleteButton" titleKey="button.delete.staff"
> value=" "/>

This has to be the first time in my life I've done anything "radical". ;)
However, in for a penny, in for a pound... I've got the nightly build from
the 16th.  With some copying of .jar and .tld files, adding a <%@ taglib>
for the html-el tags and a copy-paste of what you suggested above... IT
WORKS!

Thanks, David, and everyone who's been holding my hand these past couple of
weeks.  This webapp is SO close to actually working, and that's exciting!  I
don't know if any of you is also the sole Java programmer in a
company/department as I am.  There's no one here to ask questions of, (or
celebrate with!) so I rely heavily on the -users lists for the various
things I'm using.

-- 
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University PA Information Resources Management




RE: html:submit with an onclick

2002-10-16 Thread Karr, David

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?)
> 
>onclick="setAction('Delete Staff');
> setKeyToDelete('');"
>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:



--
To unsubscribe, e-mail:   
For additional commands, e-mail: