robrodp
asked on
Pass asp session variable to a js function in an asp script
I have an asp script (script 1) . A form vaildates the input with js. If input is ok (as determides by the js validation) it runs another asp script (script 2)
I need asp script2 to return a result to script 1 and modify the value of the submit value form:
script 2 true
script 2 false
I know that it should be addesed with an ajax approach. Beyond my scope. Script 2 is ran in a hidden frame mimics ajax. But can set or reset a session variable.
Script 1 form code: (MyIFrame is a hidden frame)
Validation code:
participante.asp wil return a session("sent") either true or false if the script was run with or without a problem. Like
scirpt 2 ran ok (true)
script 2 had a problem (false)
I need this to se the subit value to ok not ok
I need asp script2 to return a result to script 1 and modify the value of the submit value form:
script 2 true
script 2 false
I know that it should be addesed with an ajax approach. Beyond my scope. Script 2 is ran in a hidden frame mimics ajax. But can set or reset a session variable.
Script 1 form code: (MyIFrame is a hidden frame)
<form name="check" action="participante.asp" method="post" target="MyIFrame">
<input type="text" name="email" id="email" size="30" maxlength="100"><span id="email" style="font-size:8pt; padding: 3px;"></span>
<input type="hidden" value="" name="send">
<input type="button" name="enviado" value="Recuperar Número de Corredor" OnClick="return ValidatePart(this)" >
</form>
Validation code:
function ValidatePart(ccc) {
if (!validateEmail(document.check.email.value)) {
alert("La dirección de correo electrónico no es valida.");
return false;
}
ccc.disabled=true;
document.check.enviado.value='Email enviado';
document.check.send.value=ccc.value;
setTimeout('document.check.submit()',1000);
return(true)
}
participante.asp wil return a session("sent") either true or false if the script was run with or without a problem. Like
scirpt 2 ran ok (true)
script 2 had a problem (false)
if ran ok then
session("ran")=true
else
session("ran")=false
end if
I need this to se the subit value to ok not ok
in participante.asp, you should return some javascript in its onload event, so that that javascript can based on the returned results in participante.asp, may modify its parent (the form)'s value.
ASKER
I get get idea.On paticipante.aspI code <body (onloald (whaaterver) )
What to script (participante.asp whatever)
how to return (from participante.asp)
how to set it up in my form. (sript 1)
Is beyond my understanding.
Anu help will be valuable and much appreciated
What to script (participante.asp whatever)
how to return (from participante.asp)
how to set it up in my form. (sript 1)
Is beyond my understanding.
Anu help will be valuable and much appreciated
I need asp script2 to return a result to script 1 and modify the value of the submit value formwhat kind of element you want to modify here? a field's value, a div, etc?
ASKER
Script 1 will always return a email sent u¿in the submit vaue even if there was an error.
I want the error in the submit value so users can know where it was successful enogh.
I guess the cdeI snet would be self explanatory
I want the error in the submit value so users can know where it was successful enogh.
I guess the cdeI snet would be self explanatory
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Simple and to the point. Thx for the code it works like a charm