//callled from the worldpay_form_page $document.ready function init(){ if ( window.location.search.substring(1) !="" ) { var courseNumber = getPassedValue("courseNum"); var total = getPassedValue("courseCost"); var cartID= getPassedValue("cartID"); var form= document.getElementById('formbuilder'); var form2 = document.getElementsByTagName('input')[0].name; var forwardGetString = buildGetString(cartID, total); //var goTo = $("input[name=redirect]").val() var goTo = "http://tischasia.nyu.edu.sg/object/please_wait.html" + forwardGetString; $("input[name=redirect]").val( goTo ); //disable text in CourseList field $("#2287").attr("readonly", true); //disable text in CartID field $("#2286").attr("readonly", true); //disable text in TotalCost field $("#2288").attr("readonly", true); } } function buildGetString(theCartID, theTotal){ var theCartID; var theTotal; var myGetString = ""; myGetString = "?cartID="+theCartID+"&total="+theTotal; return myGetString; } function submitWorldpayForm(){ $("#worldpayForm").submit(); } function rewriteSubmit() { //remove iOns submit buttons, add custom button that calls function to tally form items and //redirect to object/worldpay_form_page.html $(".button").css("display", "none"); $("form div table").after('
Submit '); } function parseCourseSubmit() { //get form values; append course numbers into a string and tally total cost of all courses to //be passed as get string to object/worldpay_form_page.html var cartID = generateRandom(); var passParams = parseCourseList(); var courses = passParams[0] ; var total = passParams[1] ; if ( (Number(total) > 0) ){ window.location = "http://www.tischasia.nyu.edu.sg/object/worldpay_form_page.html?courseList=" + courses + "&courseCost=" + total + "&cartID=" + cartID; }else{ alert("Please select a class from the list"); } } function parseCourseList() { var courseNum = ""; var totalCost = ""; var arr= new Array(); var info= ""; //get value of all checked courses var checkedCourses = $("form input[@type='checkbox']:checked"); //go through each course and separate out pertinent part checkedCourses.each(function() { var str = this.value; //get everything in string between ( and ) firstIndex = str.indexOf( "(" ) + 1; lastIndex = str.indexOf( ")" ); info = str.substring(firstIndex, lastIndex); arr = info.split(" "); //add up each total cost courseNum = courseNum + arr[0] + " " ; //break the tuition fee into separate strings var strArr= arr[1].split(""); var courseCost = ""; for (var j=0; j"); }catch(err){ var newElement = document.createElement('input'); newElement.setAttribute('name', elementName); newElement.setAttribute('type', 'hidden'); } inputForm.appendChild(newElement); newElement.value = elementValue; return newElement; }