struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Heudecker <n...@systemmobile.com>
Subject Re: Can a <a href> be made to function as a 'submit'
Date Wed, 25 Feb 2004 15:44:48 GMT

Sure, all you need is a bit of JavaScript that submits your form tag.
The 'myForm' form is representative:

<form name="myForm">
<input type="text" name="someField1"/>
<input type="text" name="someField2"/>
</form>

<a href="javascript:submitForm();">Click</a>

And finally, the function:

<script language="JavaScript">
function submitForm() {
  document.myForm.submit();
}
</script>

That should do it.



On 2004-Feb-25 10:02, Au-Yeung, Stella H wrote:
> Hi:
> Can a <a href> be made to function as a 'submit' and upon submission, all
> the formBean properties are remembered in the Action class that handles it. 
> When  I try to use just the <a href> I can't get the formBean properties to
> be remembered.   But I can't change my list of <a href> as submit buttons
> because I need to pass arguments on each of the <a href>. 
> Here's an example of what I try to do on my JSP page:
> When the user clicks a link to see a picture of an item, this JSP will be
> replaced by another JSP with the picture.  So before I leave this page, I
> "must" save the Personal information and the item list in a temporary
> location so when I return to this page, those values will be repopulated.
> But my problem is, clicking the <a href> link will not carry over he
> formBean properties to the Action class for me to save.   'Submit' will but
> I can't change those <a href> to 'submit' because I need to pass the item
> index (0,1,2 etc.) through each <a href> to the Action class. 
> 
> Personal information:
> First Name:		Last Name:		Mailing Address:
> 
> 
> List of items in your shopping cart:
> ABC tennis racket	1	<a href> link to see a picture and pass the
> index of this item to the Action class
> Wilson tennis ball	5	<a href> link to see a picture and pass the
> index of this item to he Action class
> XYZ tenis shirt		2          <a href> link to see a picture and pass
> the index of this item to he Action class
>  
> I appreciate any suggestion.
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org

-- 
Nick Heudecker
System Mobile, Inc.
Email: nick@systemmobile.com
Web: http://www.systemmobile.com

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


Mime
View raw message