PDA

View Full Version : Not able to select value?


KaoS
11-25-2002, 10:10 PM
doono how to word it, but how do i make it so if some selects something in a form such as Select your name how do i make it so that it show a alert that says 'Please Select Your Name'?

wap3
11-25-2002, 10:32 PM
Im not sure I understand what you want so I'm just guessing.

Do you mean you want to test if a form field has been left blank ??

If so you can just use something like this:

if (yourform.namefield.value == "") { // Check if field is empty
alert("Please enter your name")
yourform.namefield.focus()
return false
}

Is that what you were after ??

:thumbsup:

KaoS
11-25-2002, 10:50 PM
Ok i have it uploaded on my site http://membres.lycos.fr/phpforums74/login.php


Ok it has a menu of login names and at the top it says Select your name... How do i make it so if you click on that then login a alert pops up and says Select your name?

KaoS
11-25-2002, 11:01 PM
...

KaoS
11-26-2002, 12:24 AM
???

KaoS
11-26-2002, 12:57 AM
:'(

whammy
11-26-2002, 01:01 AM
I looked at your site, but I'm not quite sure what you mean either... :(

Have you taken any javascript tutorials, like those at:

http://www.webmonkey.com/authoring

?

I would at least get familiar with the basics, if you aren't already :confused:

P.S. You should be more patient (3 posts in 2 hours?), and more descriptive in your exact problems/errors - the less descriptive you are the less likely that someone will be able to help you, even if they would like to.

Unfortunately your first post doesn't make any sense. :(

glenngv
11-26-2002, 01:22 AM
<form name="l"><font color="#003366">Member Name:<br>
<select name=memlist>
<option value='x'>Pick Your UserID
<option value='Admin'>Admin
</select>
<br>
Password:</br>
<input type="password" name="pass" size=15><br>
<input type="button" value="Login" onclick="check(this.form);">
...

I'm guessing here. I think what you want is when the Login button is clicked and the item selected in the Member listbox is 'Pick Your UserID', it should alert ''Please Select Your Name''.
Is that correct?
If it is, then in the check() function you should do something like this:

function check(form){
...
if (form.memlist.selectedIndex==0){
alert(''Please Select Your Name'');
return;
}
...
}