homepage Welcome to WebmasterWorld Guest from 54.237.95.6
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Javascript - Not Getting Executed
ranjankumar17




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

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.

 

korkus2000




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

Does it work with other browsers and just not IE? IE6 has a bug with the submit method.

claus




msg:1491672
 1:01 am on Aug 12, 2003 (gmt 0)

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

garann




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

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)">
...

MonkeeSage




msg:1491674
 7:55 pm on Aug 12, 2003 (gmt 0)

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

claus




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

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

MonkeeSage




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

claus:

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

Jordan

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved