• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Javascript - alert dialog box and text box

 
Bala Krishniah
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 301
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Deepa Balasubramanayam
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

------------------
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic