Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form action question

Status
Not open for further replies.

sqoti

Programmer
Dec 1, 2000
50
US
I have this

*********************************************************
<Form Action =&quot; method=&quot;post&quot; name=&quot;form1&quot;>
<textarea name=&quot;notetext&quot; rows=2 cols=30 ></textarea>
<BR>
<INPUT TYPE=&quot;submit&quot; value=&quot;Save&quot; onclick=&quot;editit();&quot; >
<input type=&quot;hidden&quot; name=&quot;EMPNO&quot; value=&quot;variable1&quot;>
<input type=&quot;hidden&quot; name=&quot;ID&quot; value=&quot;variable2&quot;>
</center>
</form>

function editit(){
if (this)
{
alert(&quot;something&quot;);
}
else
{
process text
}
}
****************************************************
What I want to do is if this condition calls for the alert I don't want the form to process. I just want it to stop after user selects ok on the alert popup. I was thinking return false, but that doesn't work.

Any ideas would be appreciated!

Thanks in advance,

Scott
 
Instead of using onclick=&quot;editit();&quot; in your input tag, do [red]onsubmit=&quot;return editit()&quot;[/red] in your <form> tag.
Then change your function to:
function editit(){
if (this)
{
alert(&quot;something&quot;);
return false
}
else
{
return true
}
}
 
return false should work, as long as you have

onSubmit=&quot;return editit()&quot;

as the submission event.

Hope that helps. Dean Owen
 
Doh, we musta been posting at the same time!

perfect, great minds think not only alike but simultaneously. Dean Owen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top