shadowspell
Programmer
A little help with javascript please...
Hi all, me again,
Could someone help me with this two function javascript?
In the first function, I want to check the value of a form field called "proj_sel_wrtype". It is a radio button field that will be equal to either "Posting" or "Project".
If the value is "Posting" then; check to see if another field, "proj_sel_posting_type" contains a value; if it does not, then throw up a javascript alert. The value is selected from a drop down menu.
In the second function, if "proj_sel_wrtype" is equal to "Project" then; check to see if a third field, "proj_sel_activity"
contains a value; if it does not, then throw up a javascript alert. The value is selected from a drop down menu.
I call the js functions from the form submit button using the onClick event. The problem is that if either "proj_sel_posting_type" or "proj_sel_activity" is left blank the form gets processed anyway. Here is the code: - - - - -
<script language="javascript">
function evaluate_1(wr1)
{
if (icsworkrequest.proj_sel_wrtype.value == "Posting")
{
if (icsworkrequest.proj_sel_posting_type == "")
{
alert("For POSTINGS, select POSTING TYPE. \n Click OK to contine.");
icsworkrequest.proj_sel_posting_type.focus();
return false;
}
}
return true;
}
function evaluate_2(wr2)
{
if (icsworkrequest.proj_sel_wrtype.value == "Project")
{
if (icsworkrequest.proj_sel_activity == "")
{
alert("For PROJECTS, select PROJECT TYPE. \n Click OK to contine.")
icsworkrequest.proj_sel_activity.focus();
return false;
}
}
return true;
}
</script>
---------------------------------
In the submit button I have,
"onClick = "return evaluate_1(icsworkrequest); return evaluate_2(icsworkrequest)"
'icsworkrequest' is the name given to the form, and I realize I'm no good at javascript.
Thanks for any help,
Chris
~`^%
Hi all, me again,
Could someone help me with this two function javascript?
In the first function, I want to check the value of a form field called "proj_sel_wrtype". It is a radio button field that will be equal to either "Posting" or "Project".
If the value is "Posting" then; check to see if another field, "proj_sel_posting_type" contains a value; if it does not, then throw up a javascript alert. The value is selected from a drop down menu.
In the second function, if "proj_sel_wrtype" is equal to "Project" then; check to see if a third field, "proj_sel_activity"
contains a value; if it does not, then throw up a javascript alert. The value is selected from a drop down menu.
I call the js functions from the form submit button using the onClick event. The problem is that if either "proj_sel_posting_type" or "proj_sel_activity" is left blank the form gets processed anyway. Here is the code: - - - - -
<script language="javascript">
function evaluate_1(wr1)
{
if (icsworkrequest.proj_sel_wrtype.value == "Posting")
{
if (icsworkrequest.proj_sel_posting_type == "")
{
alert("For POSTINGS, select POSTING TYPE. \n Click OK to contine.");
icsworkrequest.proj_sel_posting_type.focus();
return false;
}
}
return true;
}
function evaluate_2(wr2)
{
if (icsworkrequest.proj_sel_wrtype.value == "Project")
{
if (icsworkrequest.proj_sel_activity == "")
{
alert("For PROJECTS, select PROJECT TYPE. \n Click OK to contine.")
icsworkrequest.proj_sel_activity.focus();
return false;
}
}
return true;
}
</script>
---------------------------------
In the submit button I have,
"onClick = "return evaluate_1(icsworkrequest); return evaluate_2(icsworkrequest)"
'icsworkrequest' is the name given to the form, and I realize I'm no good at javascript.
Thanks for any help,
Chris
~`^%