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

V

Varun

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.
 
V

Varun

Peter Foti said:
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.
 
V

Varun

Peter Foti said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top