aspose file tools*
The moose likes Struts and the fly likes s:href and onclick , dealing with two different actions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "s:href and onclick , dealing with two different actions" Watch "s:href and onclick , dealing with two different actions" New topic
Author

s:href and onclick , dealing with two different actions

suresh midde
Greenhorn

Joined: Aug 22, 2008
Posts: 25
Hi,

I am using <s:a> tag with two actions.
I need to call javascript related action where i am submitting the form to a SaveAnswers action and later href related action in a sequence.

Right now, the method calls are happening not in sequence. i.e., in between the first method call , the second call is getting started.
So is there any way, that we can restrict the call order..

Btw, onclick or href which takes the precedence of invocation ?


<s:url id="url" action="getQuestionsForParticularPhase">
<s:param name="surveyId">
<s:property value="surveyTableVO.surveyId" />
</s:param>
</s:url>
<s:a href="%{url}" onclick="confirmsave();" ><s:property value="phaseDescription" />
</s:a>

function confirmsave(){
if(frm_questionnaire.answerChanged.value=="true"){
if(confirm('Do you want to save the answers ?')){
frm_questionnaire.action="saveAnswers.action";
frm_questionnaire.submit();
}
}
}

Regards
Suresh Midde
 
Don't get me started about those stupid light bulbs.
 
subject: s:href and onclick , dealing with two different actions
 
Similar Threads
Pass parameters to Model from anchor tag
Struts2: s:param not adding parameters to s:url
File download in struts2
downloading a file struts2
passing values from struts2 form to javascript