wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Javascript - alert dialog box and text box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Javascript - alert dialog box and text box" Watch "Javascript - alert dialog box and text box" New topic
Author

Javascript - alert dialog box and text box

Bala Krishniah
Ranch Hand

Joined: Dec 14, 2000
Posts: 81
(1)Is it possible to specify the x,y possition of the alert dialog box?
(2)I have a text box in a form. If the user clicks 'submit' without entring anything in the text box, I am able to pop up the alert dialog box. But if the user clicks in the text box, enters spaces and then clicks submit, I am not able to pop up the dialog box. How do you make a check that the textbox is empty when spaces are entered.
Thanks,
Ruyard Kipling
Greenhorn

Joined: Apr 26, 2001
Posts: 11
1: i dunna know
2: yes, but im going to bed now so im not going to explain it
[This message has been edited by Ruyard Kipling (edited April 26, 2001).]
manav kher
Ranch Hand

Joined: Nov 21, 2000
Posts: 98
well basically you have to do something like what the trim function does in Java..and what it does is it removes whitespaces from both ends of a string and if the length of the string after trim is 0 you know it was all spaces...i am not sure if javascript has a built in function that does it you will have to construct your own which removes white spaces from a string...i have it somewhere if u really really need it let me know i'll paste it here
-manav
Joel Cochran
Ranch Hand

Joined: Mar 23, 2001
Posts: 301
1. 99.999% sure you can NOT position the alert box. If it is that important, put it in a small pop-up window, you can control all kinds of things that way.
2. Here is some sample code for checking blank entries...

Here is the Form:

Be forewarned though, I've been having problems with NS4.x not always liking the ".value" functions, (MSIE and NS6 work just fine), but this code in particular has worked for me in all the browsers.
Good Luck.

------------------
I'm a soldier in the NetScape Wars...
Joel


Wait a minute, I'm trying to think of something clever to say...<p>Joel
Deepa Balasubramanayam
Ranch Hand

Joined: Mar 29, 2001
Posts: 39
Hi,
If you like to know more about it,you can take a look at this
http://developer.netscape.com/docs/examples/javascript/formval
Deepa

------------------
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Javascript - alert dialog box and text box
 
Similar Threads
How to creating an Alert Dialog window?
Any idea on Export an Excel Sheet in GWT
help me with this javascript code
Popping up MS Word in my application
disposing SAVE file dialog its urgent