Forum Moderators: open
function checkForm(){
//variable
var checkbox = document.forms[0].call_cleared.checked;
var category = document.forms[0].elements[0].options[document.forms[0].elements['cat'].selectedIndex].value
//variable
//conditional statment
if(category=="16" && checkbox == true){
alert("You must assign a category")
return false;
}
else{email() //Call function within function
return true;
}
}
function email(){
//variables
var checkbox = document.forms[0].call_cleared.checked;
var selected = document.forms[0].itstaff.selectedIndex;
var val = document.forms[0].itstaff.options[selected].value;
//variables
//conditional statments
//Checking to see if call is assigned
if(val == "16"){
return false;
}
//If call is closed send closure email
else{
if(checkbox == true){
window.open('/helpdesk/email/sendclosed.asp?callID=<%=(rscalls.Fields.Item("callID").Value)%>','','width=180,height=50','top=5000,left=5000')
}
//If call is open send email
else if(checkbox == false){
window.open('/helpdesk/email/sendnotice.asp?callID=<%=(rscalls.Fields.Item("callID").Value)%>','','width=180,height=50','top=5000,left=5000')
}
}
//conditional statments end
//-->
</script>
<form action="<%=MM_editAction%>" method="POST" name="form1" onSubmit="return checkForm()">
What exactly are you seeing wrong on your page?
[quote]
'top=5000,left=5000'
[/top]
These are very, very high - the popup will open well offscreen.
In your var category line, put a ";" at the end of the line, and also after emaail() here:
else{email() //Call function within function A description of what seems to be going would be a big help.
Ok We have two dropdown lists & one checkbox. Each fuction when on its own works fine. Never mind the asp in for the moment.
Basically in dropdown list "A" undetermined is an option and it has a value of 16. So if list "A" is undetermined and the checkbox is ticked don't process the form.
Now the second dropdown list "B" unassigned has a value of 16 as well. If "B" is unassigned don't send an email. But if it is assigned send email. It also checks to see if the checkbox is ticked which then decides the type of email to send.
Now what I want to do is bring them together.
So it really would help if you can explain the symptoms you are seeing. What happens in your browser?
But if I had to take a guess, I think the problem is here:
//If call is closed send closure email
else{
if(checkbox == true){
should be
//If call is closed send closure email
else
if(checkbox == true){
(Or another way to fix it would be to add another } just before
//conditional statments end//-->
</script>
Shawn
Because a) around 10% of users have javascript turned off and b) someone is bound to try sending you dodgy data anyway to see what happens.
I put the above sentence through a validator, and the result I got back is:
line 1, char 25: Semantic error: 'so' used to imply inference which is neither analytically nor synthetically rational. Hence by Hume's fork the statement is classified as 'non-sense'.
Good that you don't have to worry about it; makes things that much easier. ;) But just make sure that is a valid assumption.
Shawn
(PS. Don't get offended by the output of the validator. "non-sense" doesn't neccesarily mean 'BS'; it could just mean "information that can't be verified using your 5 senses" (hence non-sense data).)
It may not be deliberate. IT people are precisely the sort of rebelious lot who decide to turn off javascript in their browser because they are sick of pop-ups or because they are better educated about spy-ware/scum-ware. If you are going to rely solely on javascript for form validation, then I suggest you use javascript to submit the form, and have the form's html action be null or point to a static html page which says 'sorry, you need to turn on javascript'. That way you force people who want to submit the form to turn on javascript.
Shawn