It looks like my previous answer to this did't make its way to the list.
Posting again...



Works well with this javascript. Sorry for the french content...

/* Déclancher un submit depuis un lien */
function submitForm(aFormName, aSubmitValue) {
  var vForm = document.forms[aFormName];
  if (vForm == null) {
      alert("La page ne contient pas de formulaire nommé '" + aFormName +
"'");
  }

  var vElement = vForm.elements["submitValue"];
  if (vElement == null) {
      alert("Le formulaire '" + aFormName + "' ne contient pas le champs
'submitValue'");
  }
  else {
        vElement.value = aSubmitValue;
      return vForm.submit();
  }
}


In your jsp, this link will set the dispatch value in the form and submit
it...

<a href="javascript:submitForm('MyForm', 'MyDispatch');">Click here to
submit</a>

NOTE: Your form MUST have a hidden field named "submitValue" (or "dispatch"
or whatever...just be in sync with the script)


JCG


> -----Message d'origine-----
> De : Voinea, Marina [mailto:[EMAIL PROTECTED]
> Envoyé : vendredi 13 février 2004 15:57
> À : 'Struts Users Mailing List'
> Objet : [SPAM] - RE: <html:link> instead of <html:submit> - Bayesian
> Filter detected spam
> 
> 
> Paul, I have also been trying to use a submit within a 
> html-el:link (using
> Struts). I've been trying in different ways, none of which 
> worked, and I am
> exhausted after several days of continously surfing the net 
> and trying.
> I am not a Struts specialist, we are on our first project here.
> 
>   Could you  please include an example of your code?
>    Does it work with Struts html:link tag ?
>    (Even if it is not using Struts tag, I may try to go that way....)
>   Do we have to have a dispatch Action, can't we have  
> anormal action there:
> 
>  
>   Here is my code (which does not work...):  (Struts 1.1, 
> Weblogic 8.1)
> 
> ===========Extas from my jsp code: ============================
>  <html-el:form action="prep_address_book">
> 
>     <logic-el:iterate id="crtParticipant" indexId="idx" name="genForm"
> property="list(PARTICIPANTS)"> 
> 
>       <html-el:link  styleClass="ListDetails"
> page="/action/edit_address_book_participant" indexed="true" 
>                               indexId="current_index" name="genForm" 
>                       property="indexedValue(PARTICIPANTS:${idx}).map"
> scope="request" 
>                       onClick="document.genForm.submit();" >   
>                   <bean:write name="crtParticipant"
> property="value(LAST_NAME)"/>
>       </html-el:link>
>     </logic-el:iterate>  
>       
> </html-el:form>
> 
> ======= Struts config: =================================
> 
> //the current form whic contains the link
>    <action path="/prep_address_book" scope="request" name="genForm"
> redirect="false"
>  
> type="com.genesys.confmgr.controller.action.PrepAddressBook">
>     <forward name="success" path="/AddressBook.jsp" />
>     <forward name="edit_address_book_participant" 
> path="/AddParticipant.jsp"
> redirect="false"/>
>     <forward name="error" path="/LeftNav.jsp" redirect="false" />
>    </action>
> 
>   <action path="/edit_address_book_participant" scope="request"
> name="genForm" redirect="false"
>  
> type="com.genesys.confmgr.controller.action.EditAddressBookPar
> ticipant">
>     <forward name="success" path="/AddParticipant.jsp" />
>     <forward name="back_to_address_book" 
> path="/action/prep_address_book" />
>     <forward name="error" path="/LeftNav.jsp" redirect="false" />
>    </action>
> 
> 
> =============================================
>   in submit(), the "genForm" is the name of the form 
> associated with the
> current page (that contains the html-el:link).
>   The current behavior (of the above code)is :
>     - I have a page which displays participants (in a logic:iterate);
>     -For every participant it displays a a row with some info 
> (FirstName,
> LastNAme etc)
>     -The LAST NAME is displayed as a link, and when clicking 
> on the link:
>               -it goes to the action specified in the "page" property
> (which works OK), 
>               - it forwards the map with the values of the participant
> associated with the current row (whose link was clicked). 
> which works OK.
>               - However, with the previous code, when I get to my new
> ACtion (associated with 
> page="/action/edit_address_book_participant", the
> form I receive is empty (previous page is not submited) . I 
> only get the map
> of vales from the link).   
> 
>          Is it possible to have a "submit" type of behaviour 
> such that:
>               - when I get to my new page, I not only have the map
> forwarded by the "property" of the <html:link>, 
>               - but I also get the entire previous form 
> 
>         (I would need to have all the participant rows, not 
> just the one
> clicked - because I do not want to loose the info (the other rows) and
> either go to the back end to fetch them again, or store them in the
> session). A "submit" type behavior would give me the entire 
> form, plus the
> map provided by the link functionality.(current row data) 
>   Is this possible in Struts ? How does  <html-el:link>  tag 
> interact with
> onclick property?
>   
>   MAybe the syntax for the onclick is wrong ? Any examples please...
>   
>          
> 
>   Thank you very much for reading this long message!
> 
> 
> 
>     
> 
> 
> -----Original Message-----
> From: Paul McCulloch [mailto:[EMAIL PROTECTED]
> Sent: Friday, February 13, 2004 5:36 AM
> To: 'Struts Users Mailing List'
> Subject: RE: <html:link> instead of <html:submit>
> 
> 
> I don't beleve this will submit the values in the form's 
> input fields. I've
> achieved this functionality by having links which use 
> javascript to set the
> dispatch form value & call submit.
> 
> Paul
> 
> > -----Original Message-----
> > From: Gopalakrishnan, Jayesh 
> [mailto:[EMAIL PROTECTED]
> > Sent: 12 February 2004 19:45
> > To: Struts Users Mailing List
> > Subject: RE: <html:link> instead of <html:submit>
> > 
> > 
> > Wouldn't query parameters work here?
> > 
> > How abt using <html:link page="/youraction?buttonName=testButton" />
> > 
> > 
> > HTH..
> > 
> > -jayash
> > 
> > 
> > 
> > -----Original Message-----
> > From: Dieter Mummenschanz [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, February 12, 2004 12:46 PM
> > To: [EMAIL PROTECTED]
> > Subject: <html:link> instead of <html:submit>
> > 
> > 
> > Hello,
> > 
> > I have a jsp page with some <html:submit> buttons. The 
> > servlet identifies
> > the klicked button by invoking 
> httpservletrequest.getParameter("...").
> > Is there a way to use links in my .jsp page using <html:link> 
> > instead of
> > <html:submit>?
> > 
> > Thx for any help,
> > Dieter
> > 
> > -- 
> > GMX ProMail (250 MB Mailbox, 50 FreeSMS, Virenschutz, 2,99 
> > EUR/Monat...)
> > jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++ 
> http://www.gmx.net/derspiegel +++
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> **************************************
> Axios Email Confidentiality Footer
> Privileged/Confidential Information may be contained in this 
> message. If you
> are not the addressee indicated in this message (or 
> responsible for delivery
> of the message to such person), you may not copy or deliver 
> this message to
> anyone. In such case, you should destroy this message, and notify us
> immediately. If you or your employer does not consent to 
> Internet email
> messages of this kind, please advise us immediately. 
> Opinions, conclusions
> and other information expressed in this message are not given 
> or endorsed by
> my Company or employer unless otherwise indicated by an authorised
> representative independent of this message.
> WARNING:
> While Axios Systems Ltd takes steps to prevent computer 
> viruses from being
> transmitted via electronic mail attachments we cannot guarantee that
> attachments do not contain computer virus code.  You are 
> therefore strongly
> advised to undertake anti virus checks prior to accessing the 
> attachment to
> this electronic mail.  Axios Systems Ltd grants no warranties 
> regarding
> performance use or quality of any attachment and undertakes 
> no liability for
> loss or damage howsoever caused.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

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

Reply via email to