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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I make a message box?

Status
Not open for further replies.

allyeric

Programmer
Mar 14, 2000
104
CA
I am a VB programmer, trying to learn ASP.  In my project, I am checking that a certain text box has been filled in, and I would like to have a message box appear if its not filled in, telling user to fill in that box.  Can this be done?  I tried coding as I would in VB, but it doesn't work.  Any help is greatly appreciated.
 
Dear allyeric,<br><br>Next time include the parts of your code that don't work so people can understand the problem.<br><br>&lt;SCRIPT LANGUAGE=javascript&gt;<br>&lt;!--<br><br>function form1_onsubmit() {<br>&nbsp;&nbsp;var tx = document.form1.text1.value;<br>&nbsp;&nbsp;if ( tx.length == 0){<br>&nbsp;&nbsp;&nbsp;&nbsp;alert(&quot;Fill in that box!&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;return false;<br>&nbsp;&nbsp;}<br>&nbsp;&nbsp;return true;<br>}<br><br>//--&gt;<br>&lt;/SCRIPT&gt;<br>&lt;/HEAD&gt;<br>&lt;BODY&gt;<br>&lt;FORM action=&quot;&quot; method=POST id=form1 name=form1 LANGUAGE=javascript onsubmit=&quot;return form1_onsubmit()&quot;&gt;<br>&lt;INPUT type=&quot;text&quot; id=text1 name=text1&gt;<br>&lt;/FORM&gt;<br>&lt;/BODY&gt;<br><br>Good luck,<br>-pete
 
thanks Pete - theres not really any part of my code that doesn't work - I just didn't know how to make a message box appear with a message to the user - is there any way to do it in VBscript or do I need to use JavaScript?
 
dear allyeric,<br><br>I don't work with VBScript, however, I would be surprised if it is not supported.<br><br>Javascript support is provided in the widest range of browsers so it is the obvious choice for client side scripts. If you use VBScript your script can only be executed by browsers that support it. Beyond IE I don't even know if any others do.<br><br>As a forum etiquette note, the 'HTML/DHTML' forum would be a more appropriate choice for client side scripting questions.<br><br>Hope this helps<br>-pete
 
Pete's right.&nbsp;&nbsp;You can use VBScript in your client side scripts if you want,&nbsp;&nbsp;but if you do, you're limiting your audience to those using Internet Explorer.&nbsp;&nbsp;If you want to support Opera, Netscape, etc.&nbsp;&nbsp;you'll have to use Javascript. <p>nick bulka<br><a href=mailto:nick@bulka.com>nick@bulka.com</a><br><a href= > </a><br>
 
thats ok, it will only be accessible from a few clients on the company intranet, and the company only uses IE, so it should be ok&nbsp;&nbsp;(just out of curiosity, what is Opera?)
 
Opera is a browser written by a Scandinavian company.&nbsp;&nbsp;Their claim to fame is that the download is small, and the browser is 100% W3C compliant, and very fast.&nbsp;&nbsp;It also has an MDI interface, which means you can have multiple urls loaded into the browser at the same time.&nbsp;&nbsp;It's not free, however.&nbsp;&nbsp;I think it costs about $35.&nbsp;&nbsp;There's a public beta of Opera 4.0 going on right now.&nbsp;&nbsp;<A HREF=" TARGET="_new"> <p>nick bulka<br><a href=mailto:nick@bulka.com>nick@bulka.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top