Welcome to WebmasterWorld Guest from 54.158.51.150

Forum Moderators: open

Message Too Old, No Replies

Javascript - Not Getting Executed

     
7:30 pm on Aug 11, 2003 (gmt 0)

10+ Year Member



Hi,

The following does not work. Any clues....

<html>
<head>
<title>Sample code</title>
</head>
<body>

<script language='javascript'>
function CHK_CAT_SELECT(){
var CAT_SLC = document.frm_cat_lst.prod_access_area_frm_slc.value;
alert(CAT_SLC);
if (CAT_SLC!= ""){
document.frm_mdl_lst.prod_access_mdel_frm_slc.value = "";
return true;
}
}
function CHK_MDL_SELECT(){
var MDL_SLC = document.frm_mdl_lst.prod_access_mdel_frm_slc.value;
if (MDL_SLC!= ""){
return true;
}
}
</script>

<form name="frm_cat_lst"

action="http://njitswgt02/scripts/wgate/z_bic_offc/!?~template=bic_prod_access_lst&~event=get_models&prod_cat_area=ZROOT"

method="post" onSubmit="return CHK_CAT_SELECT()">
<select name="prod_access_area_frm_slc" onChange="document.frm_cat_lst.submit()">
<option>select a product category</option>

<option value="ZCAT01" >Printers</option>

<option value="ZCAT02" >Fax</option>

<option value="ZCAT03" >Multi-Function</option>

<option value="ZCAT04" >P-touch Labeling</option>

<option value="ZCAT05" >Laminators</option>

<option value="ZCAT06" >Stamp Creator</option>

</select>
</form>

</body>
</html>

Thanks,

Ranjan.

11:55 pm on Aug 11, 2003 (gmt 0)

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Does it work with other browsers and just not IE? IE6 has a bug with the submit method.
1:01 am on Aug 12, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



just a wild guess - you have two JS-functions, yet you call only one on submit:

onSubmit="return CHK_CAT_SELECT()">

BTW - the "return " thing...i've never used it myself, i always just use the function name, what is the reason for it?

/claus

6:09 pm on Aug 12, 2003 (gmt 0)

10+ Year Member



If you want your drop-down to submit the form when its value changes, why not put the submit in the JavaScript?


<script type="text/javascript">
function CHK_CAT_SELECT(formObj){
var CAT_SLC = document.frm_cat_lst.prod_access_area_frm_slc.value;
alert(CAT_SLC);
if (CAT_SLC!= ""){
document.frm_mdl_lst.prod_access_mdel_frm_slc.value = "";
formObj.submit();
}
}

...

<form name="frm_cat_lst"
action="http://njitswgt02/scripts/wgate/z_bic_offc/!?~template=bic_prod_access_lst&~event=get_models&prod_cat_area=ZROOT"
method="post">
<select name="prod_access_area_frm_slc" onChange="CHK_CAT_SELECT(this.form)">
...
7:55 pm on Aug 12, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



claus:

I return func() in the event handler attribute so that I can then return out of func() itself also. That way I either cancel or continue the event depending on whether the function failed or worked. Other than that I don't use it either, mosty just func() or void(func()).

Jordan

2:37 am on Aug 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Oky, i see... did garann solve the problem or are you still having problems with this? what is it exactly that you want to happen that does not happen?

/claus

2:53 am on Aug 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



claus:

I wasn't clear...I'm not Ranjan, I was just noting my own scripting habits. Sorry 'bout that. :)

Jordan

 

Featured Threads

Hot Threads This Week

Hot Threads This Month