ASP Forum
script question
gchristy | Posted 7:05pm 26. November 2007 Server Time |

I have a small vbscript to validate that a field has value before it is entered into a dbase.  The script displays the messagebox if nothing is entered. but when you click OK on the message box, the code then continues to complete and enters into the database anyway.  What can I do to keep the code from completing?

Thanks,Greg

<SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
<!--
Sub submit_onclick
if updaterec.comments.value="" then
msgbox "Please enter a valid comment."
else
updaterec.submit
end if


End Sub

-->

</SCRIPT>


-->

</SCRIPT>
change | Posted 2:32am 4. December 2007 Server Time |

try it the other way round ie use <>""
<SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
<!--
Sub submit_onclick
if updaterec.comments.value<>"" then
updaterec.submit
else
msgbox "Please enter a valid comment."
end if


End Sub

-->

</SCRIPT>


-->

</SCRIPT>


WizzKidd | Posted 5:23am 6. December 2007 Server Time |

In addition, you're code has an extra --> </SCRIPT> (any reason for this?)


Reply to Post script question



Back to Forum Page