By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,903 Members | 2,036 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,903 IT Pros & Developers. It's quick & easy.

Problem in document.formName.OnSubmit("return validationCheck(a,b,c)") event used in a function in an ASP Page

P: n/a
Hi There,
I have a form("myRequest.asp") and the values from it are
retrieved into the page ("output_Print.asp") on which I have two
buttons('Save As Complete' and 'Save As Incomplete'). When the 'Save
as Incomplete' button is Clicked the form will be going to the
"SaveAsincomplete.asp" without validation of the fields. And when the
'save as complete' is clicked certain fileds are to be validated and
by the function return value, if false stays in "output_Print.asp"
else, if true, it will taken to saveasComplete.asp.

Problems:
1. After the function returns false the actual values in the
"output_Print.asp" are not retaining as is.

2. The onSubmit() when used in a javaScript function as
(* document.Review.onsubmit= "return requiredCheck(valArray,
keywords, SpecPop, CntrctArray)";) is not working the way it should.

Code:

"output_Print.asp"

-------
Code for the form retrieving values and showing as
<HTML>
<BODY>
<FORM method="post" name="Revew">

var1=Request.form("Title")
var2...........
..............

Response.Write "Title:"&var1
...........
..........
......
.....

<input type=submit name="submit complete" value="Save as complete"
onClick="saveComplete('SaveInComplete.asp', this)">
<input type=submit name="Save as Incomplete" value="Save as
Incomplete" onClick="saveInComplete('SaveInComplete.asp')">
<input type=submit name="back" value="Edit Submission"
onclick=""history.back()"">
<Script language=javaScript>
function saveInComplete(var1)
{
document.Review.method ="POST";
document.Review.action=var1;
document.Review.submit();
}

function saveComplete(var1, frmName)
{
var errString="";
var rtnString="";
var valArray, keywords, SpecPop, CntrctArray

valArray=Review.valuesArray.value;
keywords=Review.Keywords.value;
SpecPop=Review.SpecPop.value;
CntrctArray=Review.CntrctArray.value;
document.Review.method ="post";
document.Review.onsubmit= "return requiredCheck(valArray, keywords,
SpecPop, CntrctArray)";

document.Review.action=var1;
document.Review.submit();
}
</script>
</form>
</body>
</html>
When I call the function in the javaScript

( Just like-- var bool=requiredCheck(valArray, keywords, SpecPop,
CntrctArray)";) its checking and returning the results correctly.
But when used in "document.Review.onsubmit= "return
requiredCheck(valArray, keywords, SpecPop, CntrctArray)";" I am not
returning (or even the function is not called) any values from the
function.

Any ideas on how to deal with this issue. Or any other method without
using the onsubmit() would be highly appreciated.

Awaiting for your suggestions,
Varun.
Jul 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Varun" <va*****@yahoo.com> wrote in message
news:4e**************************@posting.google.c om...
2. The onSubmit() when used in a javaScript function as
(* document.Review.onsubmit= "return requiredCheck(valArray,
keywords, SpecPop, CntrctArray)";) is not working the way it should. function saveComplete(var1, frmName)
{
var errString="";
var rtnString="";
var valArray, keywords, SpecPop, CntrctArray

valArray=Review.valuesArray.value;
keywords=Review.Keywords.value;
SpecPop=Review.SpecPop.value;
CntrctArray=Review.CntrctArray.value;
document.Review.method ="post";
document.Review.onsubmit= "return requiredCheck(valArray, keywords,
SpecPop, CntrctArray)";

document.Review.action=var1;
document.Review.submit();
}


Why not just do something like this:

function saveComplete(var1, frmName)
{
var errString="";
var rtnString="";
var valArray, keywords, SpecPop, CntrctArray

valArray=Review.valuesArray.value;
keywords=Review.Keywords.value;
SpecPop=Review.SpecPop.value;
CntrctArray=Review.CntrctArray.value;
document.Review.method ="post";

document.Review.action=var1;
return requiredCheck(valArray, keywords,SpecPop, CntrctArray);
}

I think that will work for you.
Regards,
Peter Foti
Jul 19 '05 #2

P: n/a
"Peter Foti" <pe***@Idontwantnostinkingemailfromyou.com> wrote in message news:<10*************@corp.supernews.com>...
"Varun" <va*****@yahoo.com> wrote in message
news:4e**************************@posting.google.c om...
2. The onSubmit() when used in a javaScript function as
(* document.Review.onsubmit= "return requiredCheck(valArray,
keywords, SpecPop, CntrctArray)";) is not working the way it should.

function saveComplete(var1, frmName)
{
var errString="";
var rtnString="";
var valArray, keywords, SpecPop, CntrctArray

valArray=Review.valuesArray.value;
keywords=Review.Keywords.value;
SpecPop=Review.SpecPop.value;
CntrctArray=Review.CntrctArray.value;
document.Review.method ="post";
document.Review.onsubmit= "return requiredCheck(valArray, keywords,
SpecPop, CntrctArray)";

document.Review.action=var1;
document.Review.submit();
}


Why not just do something like this:

function saveComplete(var1, frmName)
{
var errString="";
var rtnString="";
var valArray, keywords, SpecPop, CntrctArray

valArray=Review.valuesArray.value;
keywords=Review.Keywords.value;
SpecPop=Review.SpecPop.value;
CntrctArray=Review.CntrctArray.value;
document.Review.method ="post";

document.Review.action=var1;
return requiredCheck(valArray, keywords,SpecPop, CntrctArray);
}

I think that will work for you.
Regards,
Peter Foti


Ya, your idea was right and works if requiredCheck() returns
false(the onClick event has valse flase and does nothing(that is what
we wanted). But if the requiredCheck() returns true, since we are not
mentioning the document.Review.submit(); there is no action taking
place for which it should execute the form whatever.asp.

I have come up with this idea (glad that it worked):

function saveComplete(formaction, frmName)
{
var errString="";
var rtnString="";
document.Review.method ="post";
rtnString=requiredCheck(frmName);
if (rtnString){
document.Review.action=formaction;
document.Review.submit();
}
else {
return false;}
}

Thank you for your time in replying to this message.

Good Day.
Varun.
Jul 19 '05 #3

P: n/a
"Peter Foti" <pe***@Idontwantnostinkingemailfromyou.com> wrote in message news:<10*************@corp.supernews.com>...
"Varun" <va*****@yahoo.com> wrote in message
news:4e**************************@posting.google.c om...
2. The onSubmit() when used in a javaScript function as
(* document.Review.onsubmit= "return requiredCheck(valArray,
keywords, SpecPop, CntrctArray)";) is not working the way it should.

function saveComplete(var1, frmName)
{
var errString="";
var rtnString="";
var valArray, keywords, SpecPop, CntrctArray

valArray=Review.valuesArray.value;
keywords=Review.Keywords.value;
SpecPop=Review.SpecPop.value;
CntrctArray=Review.CntrctArray.value;
document.Review.method ="post";
document.Review.onsubmit= "return requiredCheck(valArray, keywords,
SpecPop, CntrctArray)";

document.Review.action=var1;
document.Review.submit();
}


Why not just do something like this:

function saveComplete(var1, frmName)
{
var errString="";
var rtnString="";
var valArray, keywords, SpecPop, CntrctArray

valArray=Review.valuesArray.value;
keywords=Review.Keywords.value;
SpecPop=Review.SpecPop.value;
CntrctArray=Review.CntrctArray.value;
document.Review.method ="post";

document.Review.action=var1;
return requiredCheck(valArray, keywords,SpecPop, CntrctArray);
}

I think that will work for you.
Regards,
Peter Foti


Ya, your idea was right and works if requiredCheck() returns
false(the onClick event has valse flase and does nothing(that is what
we wanted). But if the requiredCheck() returns true, since we are not
mentioning the document.Review.submit(); there is no action taking
place for which it should execute the form whatever.asp.

I have come up with this idea (glad that it worked):

function saveComplete(formaction, frmName)
{
var errString="";
var rtnString="";
document.Review.method ="post";
rtnString=requiredCheck(frmName);
if (rtnString){
document.Review.action=formaction;
document.Review.submit();
}
else {
return false;}
}

Thank you for your time in replying to this message.

Good Day.
Varun.
Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.