Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

LibertySal

macrumors newbie
Original poster
Dec 2, 2005
3
0
I am new to MAC, but have been given the task to trouble shoot an existing form on our company intranet that will not submit for MAC users. The form works fine for all PC, but not MAC no matter what browser. I'm hoping some of you guru's can help me out. This is the JS:
<script language="JavaScript">

//This creates the list of centers contained in the javascript array created by sub buildCentersArray.
var centersArray = new Array();
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");

function importXML()
{
xmlDoc.async="false";
xmlDoc.load('centers.xml');
xmlObj=xmlDoc.documentElement;
var rec = xmlDoc.getElementsByTagName("center");
var centerNo,centerName,emailAddress;
var x;
x = 0;
for (i=0;i<rec.length;i++)
{
centerNo = rec.item(i).getAttribute("CenterNo");
centerName = rec.item(i).getAttribute("CenterName");
emailAddress = rec.item(i).getAttribute("EmailAddress");
centersArray[x] = new Array(3);
centersArray[x][0] = centerNo;
centersArray[x][1] = centerName;
centersArray[x][2] = emailAddress;
x ++;
}
}

function buildCenterList(letter)
{
importXML();
var i,x,arrayLetter;
document.forms[0].centerList.length = 0;
document.forms[0].centerList.options[0] = new Option("Choose Center","",true,true);
x = 1;
for(i=0; i< centersArray.length; i++)
{
arrayLetter = centersArray[1].substring(0,1).toLowerCase();
if(arrayLetter == letter.toLowerCase())
{
document.forms[0].centerList.options[x] = new Option(centersArray[1],centersArray[0]);
x++;
}
}
document.getElementById('centers').style.display = 'block';
}

function fillCenterEmail(centerNo) {
for (i = 0; i < centersArray.length; i++) {
if (centersArray[0] == centerNo){
document.forms[0].email.value = centersArray[2];
}
}

}

//Ensures that the ticket form is complete before saving the ticket.
function validateForm() {
//Ensures that the center type is selected
if (document.forms[0].centerType.value=="") {
alert("Please specify a Center Type.")
return false;
}

//Ensures that when the form is accessed via browser's Back button and corporate center is previously chosen,
//the center is selected before submission
if(document.forms[0].centerType.value.toLowerCase() == "corpcenter")
{
if(document.getElementById('centerLetter').style.display == 'none')
{
checkCenterType()
return false;
}

}

//Ensures that if center letters are displayed, one is selected
if(document.getElementById('centerLetter').style.display == 'block')
{
var letterChecked = false;
for(i=0; i< document.forms[0].letter.length; i++)
{
if(document.forms[0].letter.checked == true)
letterChecked = true;
}
if(letterChecked == false)
{
alert("Please select the first letter of the Center.");
return false;
}
}

//Ensures that the center name is selected
if (document.getElementById('centers').style.display == 'block'){
if (document.forms[0].centerList.value == "") {
alert("Please specify a Center.");
return false;
}
}

//Ensures that the contact name is specified
if (document.forms[0].cName.value=="") {
alert("Please specify a Contact Name.")
return false;
}


//Ensures that an email address is entered
if (document.forms[0].email.value=="") {
alert("Please enter an email address.");
return false;
}

/*
if (!validateEmail(document.forms[0].email.value)){
alert("Please enter a valid email address.");
return false;
}
*/
//Ensures that the problem's recurring status is specified
if (document.forms[0].recur(0).checked==false && document.forms[0].recur(1).checked==false) {
alert("Please specify if the problem is recurring.")
return false;
}
//Ensures that the problem description is entered
if (document.forms[0].problemDescription.value=="") {
alert("Please specify a Problem Description.")
return false;
}

return true;
}

//This uses regular expressions to ensure that the email address has the extension @laweightloss.com
function validateEmail(email) {
//^-begging of string $-end of string i-ignore case
var regEx = /(^[a-z]*)@(laweightloss.com)$/i;
if(email.indexOf(';') > 0) {
var arrEmail = email.split(";");
var returnVal = true;
for(i=0; i<arrEmail.length; i++)
{
if(!regEx.test(arrEmail)) {
returnVal = regEx.test(arrEmail);
break;
}
}
return returnVal;
}
else
return regEx.test(email);
}


//This ensures that the center type is chosen before any other selections are made.
function checkCenterType() {

if (document.forms[0].centerType.value !="") {
if(document.forms[0].centerType.value.toLowerCase() == "corpcenter")
{
document.getElementById('centerLetter').style.display='block';
//this un-checks whatever radio button was checked earlier
for(i=0; i< document.forms[0].letter.length; i++)
{
if(document.forms[0].letter.checked = true)
{
document.forms[0].letter.checked = false;
break;
}
}
}
else
{
//clear email field if office center type is chosen after a center has been selected earlier
document.forms[0].email.value = "";
document.getElementById('centerLetter').style.display='none';
document.getElementById('centers').style.display = 'none';
}
}
else
{
//clear email if "Choose Center Type" option is chosen after a center has been chosen earlier
document.forms[0].email.value = "";
document.getElementById('centerLetter').style.display='none';
document.getElementById('centers').style.display = 'none';
}
}

//This saves the center name in a hidden form field to be used in other pages.
function saveCenterName() {
var i,centerNo;

if (document.forms[0].centerList.value !="") {
centerNo=document.forms[0].centerList.value;
i=document.forms[0].centerList.selectedIndex;
document.forms[0].centerName.value = document.forms[0].centerList.options.text;
fillCenterEmail(centerNo);
}

}
</script>

**and the form method:

<form method=post onSubmit="return false" action="helpDeskSave_xml.asp" id=form1 name=form1>

**and the submit button:

<input type="button" value=" Create Help Ticket " onClick="if (validateForm()) { document.forms[0].submit() }">

Any help at all would be greatly appreciated.....Thanks:cool: :cool:
 

LibertySal

macrumors newbie
Original poster
Dec 2, 2005
3
0
gekko513 said:
So it does work with Firefox on a PC, but not with Firefox on a Mac?
You got me! I was told it did not work only on MAC - I just tested PC Firefox and it Does NOT work!! What does that tell us?
 

gekko513

macrumors 603
Oct 16, 2003
6,301
1
LibertySal said:
You got me! I was told it did not work only on MAC - I just tested PC Firefox and it Does NOT work!! What does that tell us?
I'm not sure exactly. I'm not good with Javascript.

The script probably uses something that is Internet Explorer specific and not standard compliant.
 

LibertySal

macrumors newbie
Original poster
Dec 2, 2005
3
0
You guys are awesome...I really appreciate your help, and so quickly, too!
;)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.