You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Krishna, Hari (FTT-CInternet)" <HK...@Templeton.com> on 2007/04/26 07:44:13 UTC
Form submission
Hi all,
I am facing a peculiar problem with form submission. In my jsp I am
using html:submit tag to create a submit button and calling a javascript
method populateAndSubmit() which will do a form submission with
document.ChallengeQuestionForm.submit();
Now the issue is this form is getting submitted two times occasionally.
I am really surprised to see this random behaviour and please let me
whether replacing html:submit with input type="submit" will solve the
problem?
<html:submit onclick="populateAndSubmit()" tabindex="37"
></html:submit>
function populateAndSubmit()
{
if(myId[1]!=-1)
{ //This check ensures that challenge questions
are selected
for(i=1;i<=4;i++)
{
index=myId[i];
if(document.getElementById("check"+index).value!=" ")
questionelementId="check"+index;//system question
else
questionelementId="user"+index;//userquestion
anselementId="text"+index;
if(i==1)
{
document.ChallengeQuestionForm.challengeQuestion1.value
=document.getElementById(questionelementId).value;
document.ChallengeQuestionForm.challengeAnswer1.value
=document.getElementById(anselementId).value;
if(index==1) {//if the index is 1 ,
this is the date of birth question, so set the answer from the
mm/dd/yyyy fields
document.ChallengeQuestionForm.challengeAnswer1 .value =
document.ChallengeQuestionForm.month.value +
"/"+document.ChallengeQuestionForm.date.value+"/"
+document.ChallengeQuestionForm.year.value;
}
}
if(i==2)
{
document.ChallengeQuestionForm.challengeQuestion2.value
=document.getElementById(questionelementId).value;
document.ChallengeQuestionForm.challengeAnswer2.value
=document.getElementById(anselementId).value;
}
if(i==3)
{
document.ChallengeQuestionForm.challengeQuestion3.value
=document.getElementById(questionelementId).value;
document.ChallengeQuestionForm.challengeAnswer3.value
=document.getElementById(anselementId).value;
}
if(i==4)
{
document.ChallengeQuestionForm.challengeQuestion4.value
=document.getElementById(questionelementId).value;
document.ChallengeQuestionForm.challengeAnswer4.value
=document.getElementById(anselementId).value;
}
}
}
document.ChallengeQuestionForm.submit();
}
Regards,
I.HariKrishna | Software Engineer | Franklin Templeton International
Services (India) Pvt. Ltd. | Franklin Templeton Centre,1st Floor,
No.7,Third Cross Street, Kasturba Nagar, Adyar, Chennai 600020
| Tel: +91 44 24407000 | Extn: 17123 | Fax: +91 44 24453661 | Mobile:
+91 9884528587 | www.franklintempleton.com
Notice: All email and instant messages (including attachments) sent to
or from Franklin Templeton Investments (FTI) personnel may be retained,
monitored and/or reviewed by FTI and its agents, or authorized
law enforcement personnel, without further notice or consent.