JavaScript - Return False Method Is Producing Double Alert Windows
I am getting double Alert prompts for a single form: The alert pops up the first time, then when I click OK, the same one pops open again. I think my code should do the alert once when it hits "else window.alert(sameWarning) and the stop when it reaches "return false()"; but it seems return false() is causing the alert twice. Maybe because I have two forms on one page; yet, they have two separate function names ("signinForm()" and "saveSignUp()")and call two separate forms (forms[0] and forms[1])? I think my code is correct, but I can't figure it out at this point. Any help would be appreciated. Thanks in advance!
Code: <script type="text/javascript"> //FIRST FUNCTION FOR FORMS[0] function signinForm(){ // var sameWarning = "The required fields were not submitted for the following error(s). \n \n"; var warningLogin = "The following field(s) require an entry: \n \n"; var sameWarning = warningLogin; var userName = document.forms[0].userName.value; var pswd = document.forms[0].pswd.value; if(userName == ""){ sameWarning += " - First Name \n"; } if(pswd == ""){ sameWarning += " - Password \n"; } if (warningLogin == sameWarning){ return true; } else { window.alert(sameWarning); } return false; } //SECOND FUNCTION CALL FOR FORMS[1] function saveSignUp(){ // var warning = "The required fields were not submitted for the following error(s). \n \n"; var warning = "The following field(s) require an entry: \n \n"; var same = warning; var firstName = document.forms[1].firstName.value; var lastName = document.forms[1].lastName.value; var email = document.forms[1].email.value; var phone = document.forms[1].phoneNumber.value; if(firstName == ""){ //firstName.style.backgroundColor="red"; warning += " - First Name \n"; } if(lastName == ""){ warning += " - Last Name \n"; } if(email == ""){ warning += " - Email \n"; } if(phone == ""){ warning += " - Work Phone \n"; } if(phone < 5 ){ warning += " - Must be a numberssss \n"; } if (warning == same){ return true; } else { alert(warning); } return false; } </script> HTML Code: <h1>Login</h1> <form method="post" onsubmit="return signinForm();" action="" > <input type="text" placeholder="Username/Email" name="userName"> <input type="password" placeholder="Password" name="pswd" id="pswd"> <input type="submit" onclick="signinForm();" value="Sign In"> </form> <h1>Sign Up!</h1> <form method="post" onsubmit="return saveSignUp()" action="" > <input type="text" placeholder="First Name" name="firstName"> <input type="text" placeholder="Last Name" name="lastName"> <input type="text" placeholder="Email" name="email"> <input type="text" placeholder="Phone Number" name="phoneNumber"> <input type="submit" onclick="saveSignUp();" class="button wide" value="Request an Account"> </form> *UPDATE Fixed! After I removed the onclick in the button, the double alerts went away. Apparently, I was I was firing off two events (calling the javascript twice) with both the onsubmit and the onclick. Just wondering: 1. Is "onsubmit" a special event handler just for button "type=submit" vs onlclick can be used for any element? 2. Is there a preference among developers to use onclick vs. onsubmit? 3. Is there an order of precedence for method calls over submit calls (the onclick goes first, then it automatically fires the submit call to the function too)? Similar TutorialsI don't understand the logic of Break, Return False, Return True. It was never really covered in our college class, and I see everyone using it. I got an A in the class, if that 'proves' that I really tried to apply myself. NOTE: I understand what the function is doing. I just don't understand WHEN to use break, return false or return true if the the translator can determine the conditional statements. PHP Code: function submitForm(){ var ageSelected = false; for (var i=0; i<5; ++1){ if (document.forms[0].ageGroup[i].checked == true) { ageSelected = true; break; } } if (ageSelected == false){ window.alert("You must select your age group"); return false; } else return false; } if the the translator can determine the conditional statements, why not write it like this: PHP Code: function submitForm(){ var ageSelected = false; for (var i=0; i<5; ++1){ if (document.forms[0].ageGroup[i].checked == true) { ageSelected = true; break; // what's the point for the 'break'? Won't the rest of the code be ignored since it passed the first condition? } } if (ageSelected == false){ window.alert("You must select your age group"); return false; } // why not leave the last else out? is it just a 'safety' catch, in case something other than true or false is inputted? else return false; // what's the point? } Questions: Why use return true, if the translator knows it's ture? Why use "return false" if the translator knows it's false and the alert window has already gone up? why not use "break" to stop the code? Why use the "return false" at the end "else" statement? Hi room, Hey, I opened up the source code for this page in google chrome and since i'm learning javascript, i wanted see if i could "read" it and figure out what was going on. I'm am having the hardest time understanding "return false" and "return true". Could someone step me through this via interpreting this code (in bold typeface): Code: var DefaultValue = 'Search'; function clearSearch() { if (document.searchForm.q.value == DefaultValue) { document.searchForm.q.value = ''; } } function validateSearchHeader() { if ( document.searchForm.q.value == '' || document.searchForm.q.value.toLocaleLowerCase() == DefaultValue.toLocaleLowerCase() ) { alert('Please enter at least one keyword in the Search box.'); document.searchForm.q.focus(); return false; } return true; } Thanks! Okay, on my website I have some javascript code I'm using to make the user input required text. If they don't enter info in all the required fields an alert box appears (nothing new).. The issue is, when you click okay, it redirects to a page and just says "false." It only does this in IE9.. Chrome has no issues.. Any idea? or resolutions? website issue he https://pcexpresstechs.com/get_started.html here is the code: Code: function verify() { var themessage = "You are required to complete the following fields: \n"; if (document.input.first.value=="") { themessage = themessage + " - First Name"; } if (document.input.last.value=="") { themessage = themessage + " - Last Name"; } if (document.input.email.value=="") { themessage = themessage + " - Email Address"; } if (document.input.phone.value=="") { themessage = themessage + " - Phone"; } //alert if fields are empty and cancel form submit if (themessage == "You are required to complete the following fields: \n") { document.input.submit(); } else { alert(themessage); return false; } } Hi I've managed to change the border color whenever someone clicks on another link on my page but because I need to use return false to keep the color it is stopping the link from going to that page; Code: <script type="text/javascript"> function changeColor(color) { document.getElementById("nav").style.borderColor = color; } </script> <a href="index.php" onclick="changeColor('red') ;return false">HOME</a> <a href="about.php" onclick="changeColor('blue') ;return false">ABOUT</a> <a href="contact.php" onclick="changeColor('orange') ;return false">CONTACT</a> Any help would be appreciated, I've only recently got into JS Cheers Hi all, I have a page built with asp.net that includes some "imagebutton"s within a form. These render as input tags with the type set to image. I ahve the onclick attribute set to run a custom javascript function and return false, so in the fully rendered page I get something like the following: Code: <input type="image" name="ctl00${cut}" tabindex="-1" title="Click to look up the details" src="images/load_details.png" onclick="LoadDetails(); return false;" style="border-width:0px;" /> This has worked fine for the few months the code has been in place and then just recently (within the last few days) it has stopped working for a single network user. They click on the link and instead of the function executing (and the AJAX loading details into the page) the form submits. This makes me think that the "return false" simply isn't executing. The user says that they haven't changed any settings or anything that may cause this issue... The browser being used throughout the company is IE8 under Windows XP. I have checked the version being used on their comptuer and it is 8.0.6001.18702, which is the same version as the one installed on my local machine... which is working fine. Another user has logged into the computer being used by the user with the issues and it works fine for the second user. Also, the user having the issues has logged into a different computer on the network and was still having the same problems. I think I've included all the details, but I'll happily provide any required information. Anyone have any ideas? I have the following form: Quote: <form action="/cgi-bin/script.cgi" method="POST" onsubmit="check_create()"> <fieldset> <legend>Create project</legend> Type <input id="type" type="text" name="type" size="20" /><br/> Name <input id="project" type="text" name="project" size="20" /><br/> Language to use <input id="language" type="text" name="language" size="20"/><br/> <input type="hidden" name="profile" value="[% profile %]"/> <input type="submit" value="Create" /> </fieldset> </form><br/> and check_create function is: Quote: function check_create() { var type = document.getElementById('type').value; var pname = document.getElementById('project').value; var language = document.getElementById('language').value; if ((type == '') || (pname == '') || (language == '')) { alert('You must complete form'); return false; } else alert('Ok'); } The problem is that return false doesn't work, but form lanch /cgi-bin/script.cgi. Where is the problem? Why return false doesn' work? Regards, savio hi peeps, this one might be confusing, if so i apologise! below is a cut down version of the script calling a function: Code: function updateStockRequest(thestatus,theform,thedate) { if(thestatus == 'locked') { if(checkStockRequested()) { if(confirm('Are you sure you want to send for processing?\nYou will not be able to add any more stock!')) { document.getElementById('status').value = 'locked'; document.forms[0].submit(); } } else { alert('You must request some stock first!'); } } } the following is the function being called: Code: function checkStockRequested() { //check to see if stockrequest has items added!!! xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request"); return; } var params = "?theuid=" + escape(document.getElementById('uid').value); var url="_check_stockrequest.php" url=url+params; ajaxedInner = ""; xmlHttp.open("GET",url,true); xmlHttp.setRequestHeader("If-Modified-Since", "Fri, 31 Dec 1999 23:59:59 GMT"); xmlHttp.onreadystatechange=stateChanged; xmlHttp.send(null); xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4){ if (xmlHttp.status == 200) { responsestring = xmlHttp.responseText.replace(/^\s+|\s+$/g, ''); alert(responsestring); if(responsestring == 'true') { return true; } else { return false; } } } } } in the testing the function is alerting 'true' but the calling function still fails and says you need to add stock. i must admit ive rarely used the return syntax so maybe im doing it wrong?!? ive tried many variants such as creating a variable and assigning it the string 'true' etc and then using if(checkStockRequested == 'true') but it still fails. help!!!!!!!!! hi guys, i need a javascript for my checkbox 1st: need to check the checkbox to go to next page or else stay at current page with an alert popout "Please check the checkbox" can some one help me please? Lets say I have a MySQL value of 4... and I have a HTML INPUT field.. Is there a way to make it so that if a client tries to submit a value higher than 4, then they will be returned a message? Something like: Code: <SCRIPT type="text/javascript"> function validateForm() { if (document.forms["form"]["quantity"].value== (+$row['quantity']) { alert ("Cannot submit because the quantity specified is not available."); return false; } } </SCRIPT> <INPUT name="quantity" onsubmit="return validateForm()> I am having trouble with some JavaScript that is supposed to add some Google Analytics tracking parameters to "cross-domain" links (used to auto append tracking info across multiple domains as a way of sharing the Google cookie info). I have my code kind of working at this point except the default event (the normal href link) is not stopping. Instead my new event (the link plus Google parameters) fires off and is immediately replaced by the default (no parameters) event. For links that open in a new window, two windows open, one the standard link and one with the intended parameters. I am using a return false; on each link type but it is not doing anything. Any ideas how I can stop the default event? Code: Code: //Last Updated 5/10/12 /*Regex list of on-site domains, pipe and backslash delimited. */ var wa_onsiteDomains = /mydomain\.com|my2nddomain\.com|my3rddomain\.com|javascript/i; /*Used to unobtrusivly add events to objects*/ function unobtrusiveAddEvent (element,event,fn) { var old = (element[event]) ? element[event] : function () {}; element[event] = function () {fn(); old();}; } function wa_crossDomainLink(i) { return function () { var thisLink = decodeURI(wa_links[i]); var thisLinkTarget = wa_links[i].target; if (typeof(_gaq) == "object") { if(thisLinkTarget == "_blank") { var wa_myTracker=_gat._getTrackerByName(); var wa_fullUrl = wa_myTracker._getLinkerUrl(thisLink); window.open(wa_fullUrl); return false; } else { _gaq.push(['_link', thisLink]); return false; } } }; } var wa_links = document.links; if ( wa_links ){ for(var i=0; i<wa_links.length; i++) { if( wa_links[i].href.match(wa_onsiteDomains) && !wa_links[i].href.match(location.hostname)){ unobtrusiveAddEvent( wa_links[i], 'onclick' , wa_crossDomainLink(i)); } } } Note, the code above resides in a separate js file and is called at the bottom of every page. Thanks! I've got this bit of code that I've wrote and it was working absolutely fine like this: Code: function validatepostcode() { var postcodevalue = document.getElementById("postcode").value; if (postcodevalue.indexOf("S") == -1) { alert(postcodevalue + " is not a valid postcode."); } } Until I tried to add double quotes: Code: function validatepostcode() { var postcodevalue = document.getElementById("postcode").value; if (postcodevalue.indexOf("S") == -1) { alert( \" postcodevalue \" + " is not a valid postcode."); } } What I want to do is wrap the value of "postcodevalue" in double quotes, and since it's inside an alert, I used the escape sequence \", which is how it should be done as far as I know. But for some reason, Dreamweaver's giving me a syntax error warning and the code doesn't work. Am I using the double quotes wrong? Regards, Hashim. Hi All, This is in ASP.Net Im creating a task loggin system and this allows the user to raise tasks and update them, im using javascript for validation and if the fields are empty it then changes the fields back ground to Red which is fine but then it goes on to update the data in SQL which i dont want, any suggestions or how i can achieve no post back is the result from the function is False (for fields in error) Html Code where im calling the function Code: <asp:button runat="server" id="btnChangeCommentsAuth" CSSclass="RaiseButton" OnClientClick="CommentsCheck('MainDisplayContentChange_txtAuthCommentsArea');" PostBackUrl="~/RaiseTaskChange.aspx" Text="Auth" /> Javascript function Code: function CommentsCheck(comments) { var com; var result = new boolean(); com = document.getElementById(comments); if (document.getElementById(comments).value == '') { com.style.backgroundColor = "#B20635"; result = 0; } else { result = 1 } } Thanks in Advance look forward to your reply. Hi Guys, I want to develop a javascript code which will open a pop up window and a JSP page in it. That JSP page will load a 'Select' list which user will select a value from and I want that value to be returned to my parent form (window). I remember implementing the same long time back (almost 5years now) ...can anyway help remind me how did I do it...or how can I do it? Regards, -- SJunejo Hi I'm banging my head against this problem and I'd really appreciate some help. I think the problem is cause by my lack of understanding of how the browser (firefox 3.6.3) handles focus. A simplified version of my problem is: I've defined the function Code: function two_focus() { document.getElementById("two").blur(); alert("hello"); } then in the body I have the form with two text boxes Code: <input id="one" type="text"><input id="two" type="text" onfocus="two_focus();"> When the page is loaded and I click in the second textbox I get the alert, all well and good. I OK the alert box, but when I click on box 1, or anywhere on the page for that matter, the function is called and the alert comes up. I just don't understand why the focus is being returned to the second box when I click anywhere in the browser window. Any comments will be gratefully received. I have an user table like this:- guid | username | password | firstname | lastname | location | emailad dress | userrole -----------------------------------+----------+----------------------------------+-----------+-----------+----------+-------- ------+--------------- 8024259764dc3e8ee0fb6f5.84107784 | james | 827ccb0eea8a706c4c34a16891f84e7b | james | bond | NY | ny@live .com | administrator 18689183644dc3e91571a364.71859328 | saty | 250cf8b51c773f3f8dc8b4be867a9a02 | saty | john | NY | hk@fd.c om | administrator 2644885344cecd6f2973b35.63257615 | admin | 21232f297a57a5a743894a0e4a801fc3 | System | Generated | | | administrator (3 rows) now my postgre query for delete the row .... $query = "delete from users where username!= 'admin' and guid='".$guid."'"; $result = pg_query($conn, $query); ?> <script type="text/javascript"> alert("Cannot delete this .\n It is system generated(s)."); </script> <?php (1)when I delete the user name one by one then delete occurs in my page userlist.php, I donot want to delete admin so i use username!= 'admin' in where condition as shown above. (2)now when I del any username(3 rows) from user table then alert occurs & it delete from userlist.php after that my page userlist.php is blank. Finaly when i refresh the page then my admin username seen.. when i use return true; function then only alert generate .. delete doesnot occurs ... Actauly i want:- (1)if user is not admin then it delete from userlist.php ... nd also i m continue on this page ... like when james and saty want to delte their acount ..as given in table. (2)if user is admin then alert generate nd i m continue on this page. i m tired now plz help me .... so can anyone put the best condition in my coding. Why is the callwhy is the slice method only a method of an Array instance? The reason why I ask is because if you want to use it for the arguments property of function object, or a string, or an object, or a number instance, you are forced to use Array.prototype.slice.call(). And by doing that, you can pass in any type of object instance (Array, Number, String, Object) into it. So why not just default it as a method of all object instances built into the language? In other words, instead of doing this: Code: function Core(){ var obj = {a : 'a', b : 'b'}; var num = 1; var string = 'aff'; console.log(typeof arguments);//Object console.log(arguments instanceof Array);//false var args1 = Array.prototype.slice.call(arguments); console.log(args1); var args2 = Array.prototype.slice.call(obj); console.log(args2); var args3 = Array.prototype.slice.call(num); console.log(args3); var args4 = Array.prototype.slice.call(string); console.log(args4); Core('dom','event','ajax'); Why not just be able to do this: Code: function Core(){ var obj = {a : 'a', b : 'b'}; var num = 1; var string = 'aff'; var args = arguments.slice(0); var args2 = obj.slice(0); var args3 = num.slice(0); var args4 = string.slice(0); //right now none of the above would work but it's more convenient than using the call alternative. } Core('dom','event','ajax'); Why did the designers of the javascript scripting language make this decision? Thanks for response. The code below allows the user to hover over 1 object and it not only replaces the object but also shows an additional object between the buttons. It works great in Firefox, but does not in Internet Explorer. HELP webpage: http://www.isp.ucar.edu/ ------------ standard mouseover commands are used in index.php <CODE> <a href="http://www.tiimes.ucar.edu/beachon/" onMouseOver="imgOn('img1')" onMouseOut="imgOff('img1')"> <img src="images/buttons/button-beachon.gif" alt="BEACHON" width="181" height="74" border="0" id="img1" /></a> </CODE> ------------ <CODE> if (document.images) { img1on = new Image(); img1on.src = "images/buttons/button-beachon-on.gif"; img1off = new Image(); img1off.src = "images/buttons/button-beachon.gif"; img2on = new Image(); img2on.src = "images/buttons/button-bgs-on.gif"; img2off = new Image(); img2off.src = "images/buttons/button-bgs.gif"; img3on = new Image(); img3on.src = "images/buttons/button-iam-on.gif"; img3off = new Image(); img3off.src = "images/buttons/button-iam.gif"; img4on = new Image(); img4on.src = "images/buttons/button-nvia-on.gif"; img4off = new Image(); img4off.src = "images/buttons/button-nvia.gif"; img5on = new Image(); img5on.src = "images/buttons/button-utls-on.gif"; img5off = new Image(); img5off.src = "images/buttons/button-utls.gif"; img6on = new Image(); img6on.src = "images/buttons/button-water-on.gif"; img6off = new Image(); img6off.src = "images/buttons/button-water.gif"; img7on = new Image(); img7on.src = "images/buttons/button-exploratory-on.gif"; img7off = new Image(); img7off.src = "images/buttons/button-exploratory.gif"; // second image that does not appear in original button space img1ad = new Image(); img1ad.src = "images/buttons/beachon-overview-sm.gif"; img2ad = new Image(); img2ad.src = "images/buttons/bgs-overview-sm.gif"; img3ad = new Image(); img3ad.src = "images/buttons/iam-overview-sm.gif"; img4ad = new Image(); img4ad.src = "images/buttons/nvia-overview-sm.gif"; img5ad = new Image(); img5ad.src = "images/buttons/utls-overview-sm.gif"; img6ad = new Image(); img6ad.src = "images/buttons/water-overview-sm.gif"; img7ad = new Image(); img7ad.src = "images/buttons/exploratory-overview-sm.gif"; } { function imgOn(imgName) { if (document.images) { document[imgName].src = eval(imgName + "on.src"); document["holder"].src = eval(imgName + "ad.src"); } } } function imgOff(imgName) { if (document.images) { document[imgName].src = eval(imgName + "off.src"); document["holder"].src = "images/buttons/isp-overview-sm.gif"; } } </CODE> this is my javascript code: Code: var aaa, aab; aaa = choo.chooserver0.checked; aab = choo.chooserver1.checked; k=(aaa==true)?0:(aab==true)?1:(aaa=true&&aab==true)? 'b2' : false ; now when the checkbox with id chooserver0 is checked, it sets k's value to 0, and when checkbox with id chooserver1 is checked it sets its value to 1, but when both are checked it must set value to b2, but it sets value to 0, why? and when i write it as: Code: var aaa, aab; aaa = choo.chooserver0.checked; aab = choo.chooserver1.checked; k=(aaa=true&&aab==true)? 'b2' :(aaa==true)?0:(aab==true)?1: false ; when box 1 is checked, it sets k= false, when box2 is checked it sets k= 'b2' and when both are checked it sets k = 'b2'... why is code doing so? Hello all. I have started working on my companies website, http://www.janwyck.net Within it is an order form for ordering paint sundries from a shopping cart using javascript and cookies. After the customer selects a few items and fills out the form if they hit Submit, it brings up a pop-up that says First False. The only way I know to show you guys is to show the page code, I am sorry: Code: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="GENERATOR" content="Microsoft FrontPage 2.0"> <title>Janwyck Decorating Center</title> </head> <script language="javascript"> index = 0; function format(val, post) { var decpoint; var begin; var end; var valstr; var temp_char; valstr = "" + val; //alert('valstr = ' + valstr); decpoint = valstr.indexOf(".") if (decpoint != -1) { //alert('decpoint = ' + decpoint); begin = valstr.substring(0,decpoint); end = valstr.substring(decpoint+1,valstr.length); //alert('begin = ' + begin + '\nend= ' + end); } else { begin = valstr; end = ""; } if (end.length < post) {while (end.length < post) { end += "0"; } } end = end.substring(0,post); //alert('begin = ' + begin + '\nend= ' + end); return (begin+"."+end); } function orderSubmit(type) { if (type == 'order') {if ( ! ( (document.order.order_type.checked) || checkRequired() )) { // checkCardNumber(); ENTRY HERE alert('first true'); document.order.form_action.value = type; document.order.submit(); return true; } else { alert('first false'); return false; } } } var infowin = null; function copyToShipping() { if (document.order.same_flag.checked) { document.order.ship_name.value = document.order.name_first.value+' '+document.order.name_last.value; document.order.ship_address1.value = document.order.address1.value; document.order.ship_address2.value = document.order.address2.value; document.order.ship_city.value = document.order.city.value; document.order.ship_state.value = document.order.state.value; document.order.ship_zip.value = document.order.zip.value; document.order.ship_country.value = document.order.country.value; document.order.ship_phone.value = document.order.phone.value; } } function disableSameFlag() { document.order.same_flag.checked = false; } function checkRequired() { if (!document.order.name_first.value.length || !document.order.name_last.value.length || !document.order.email.value.length || !document.order.address1.value.length || !document.order.city.value.length || !document.order.state.value.length || !document.order.zip.value.length || !document.order.country.value.length) { alert('You have not completed all required fields:\n' + 'Please complete the Name, Address, City,\n' + 'County, Post Code, and Country in the\n' + 'Customer Info section'); return true; } else { return false; } } <!-- --> </script><!-- --><a name="top"></a> <body background="images/thisback.gif" bgcolor="#FFFFFF" text="#000000" onLoad=parent.refresh_ship_details(parent.ship_details) onUnload=parent.add_ship_details(parent.ship_details)> <center> <script language="javascript"> <!-- hide if (self==parent){document.write('<font color=#ff000><b>This is a frame element, click <a href=index.htm> here </a>for correct page</b></font>')}; <!-- end hide --> </script> <p><font color="#FF0000" size="7"><i>Janwyck Order Form</i><br> </font></p> <table border="0" width=400> <tr> <td align="center" bgcolor="#FF0000"><font color="#FFFFFF"><b>Please wait while the scripted order form is generated....... </b></font> </td> </tr> </table> <p><font size="6">Order Form</font> <br> <!-- HEY!!! PUT YOUR EMAIL ADDRESS IN THE LINK BELOW SO THEY CAN WRITE TO YOU --> <b>In the event of difficulty with this script please email us direct on <a href=mailto:janwyckpaint@gmail.com>Janwyck Paint</a> or call us on (706)865-2811</b> </p> <!-- YOU CAN PUT YOUR EMAIL ADDRESS IN THE FORM COMMAND BELOW AND THE --> <!-- THEN IT WILL BE SENT TO YOU AS A SIMPLE MAILTO GUESTBOOK FORM --> <!-- IF YOU DO THAT - BE SURE TO ADD THE COMMAND enctype="plain/text" --> <!-- IN ORDER TO DELINEATE THE MAIL FOR YOU --> <!-- YOU CAN ALSO USE TE .PL FILE AS A CGI TO HELP WTH THE MAIL. SEE THE TUTORIAL --> <!-- FOR MORE ON HOW THAT IS DONE --> <form action="MAILTO:janwyckpaint@gmail.com" method="POST" name="order" enctype="plain/text"> <input type="hidden" name="Order Form" value="Order Forms - Order Form"><input type="hidden" name="recipient" value="janwyckpaint@gmail.com"><input type="hidden" name="redirect" value="thanku.htm"><input type="hidden" name="retailer" value="Janwyck Decorating Center"><input type="hidden" name="form_action" value="order"> <script language="javascript"> <!-- hide from Browsers document.write('<table width=400><td align=center>'); document.write('<table width=400 ><tr><tr><td align=right colspan=3 BGCOLOR=#FF9999><font size=+2>Running Total : $ </td><td colspan=3 BGCOLOR=FF9999> <input type=text name=total size=6 value='+ format(parent.all_order_totals(),2) + '></font></td><tr>'); document.write('<td colspan=6 align=center><b>This is your Order Total so far<br>.</td></tr><tr></table>'); if (parent.items_ordered == 0) document.write('<font color=#000080><b>You have not ordered any items so far<b></font>'); if (parent.item_num > 0) { for (i =1;i < parent.item_num;i++) { if (parent.itemlist[i].quan > 0) {index = index + 1; document.write('<a href='+ parent.itemlist[i].url + '><i><b> review : </b></i></a><input size=10 type=text name= ' + parent.itemlist[i].code + ' value= ' + parent.itemlist[i].code + '><input size=6 type=text name= ' + parent.itemlist[i].code + ' value=' + parent.itemlist[i].price + '><input size=20 type=text name= ' + parent.itemlist[i].code + ' value= '+ parent.itemlist[i].desc + '><input size=2 type=text name= ' + parent.itemlist[i].desc + ' value= '+ parent.itemlist[i].quan + '><br>'); } } } <!-- end hiding --> </script> <table border="0" width=400> <tr> <td align="center" colspan="6" bgcolor="#FF9999"><b>Comments & Additional Information <br><font color=#ffff00>Can be written in the box below</font><br> </b></td> </tr> <tr> <td colspan="6"><center><textarea name="comments" rows="10" cols="40"></textarea></center></td> </tr> </table> <!-- Customer Info Table --> <table border="0" cellpadding="0" cellspacing="0" bgcolor="#00FFFF" width=400> <tr> <td align="center" colspan="5" bgcolor="#CCFFFF"><b>Customer Information / Details</b></td> </tr> <tr> <td align="right" colspan="2" bgcolor="#CCFFFF"><b>First Name: </b></td> <td colspan="3" bgcolor="#CCFFFF"><input type="text" size="30" maxlength="30" name="name_first"></td> </tr> <tr> <td align="right" colspan="2" bgcolor="#CCFFFF"><b>Last Name:</b> </td> <td colspan="3" bgcolor="#CCFFFF"><input type="text" size="30" maxlength="30" name="name_last"></td> </tr> <tr> <td align="right" colspan="2" bgcolor="#CCFFFF"><b>Email Address:</b> </td> <td colspan="3" bgcolor="#CCFFFF"><input type="text" size="30" maxlength="60" name="email"></td> </tr> <tr> <td align="right" colspan="2" bgcolor="#CCFFFF"><b>Address:</b> </td> <td colspan="3" bgcolor="#CCFFFF"><input type="text" size="30" maxlength="60" name="address1"></td> </tr> <tr> <td align="right" colspan="2" bgcolor="#CCFFFF"> </td> <td colspan="3" bgcolor="#CCFFFF"><input type="text" size="30" maxlength="60" name="address2"></td> </tr> <tr> <td align="right" colspan="2" bgcolor="#CCFFFF"><b>City:</b> </td> <td colspan="3" bgcolor="#CCFFFF"><input type="text" size="30" maxlength="30" name="city"></td> </tr> <tr> <td align="right" colspan="2" bgcolor="#CCFFFF"><b>County:</b> </td> <td bgcolor="#CCFFFF"><input type="text" size="8" maxlength="10" name="state"></td> <td align="right" bgcolor="#CCFFFF"><b>Post Code:</b> </td> <td bgcolor="#CCFFFF"><input type="text" size="9" maxlength="10" name="zip"></td> </tr> <tr> <td align="right" colspan="2" bgcolor="#CCFFFF"><b>Country:</b> </td> <td colspan="3" bgcolor="#CCFFFF"><input type="text" size="25" maxlength="25" name="country" value="UK"></td> </tr> <tr> <td align="right" colspan="2" bgcolor="#CCFFFF"><b>Phone:</b> </td> <td colspan="3" bgcolor="#CCFFFF"><input type="text" size="25" maxlength="25" name="phone"></td> </tr> <tr> <td align="right" colspan="2" bgcolor="#CCFFFF"><b>Fax:</b> </td> <td colspan="3" bgcolor="#CCFFFF"><input type="text" size="25" maxlength="25" name="fax"></td> </tr> <tr> <td align="center" colspan="5" bgcolor="#CCFFFF"><input type="checkbox" name="mail_list">Check here to be included on our mailing list </td> </tr> </table> <p align="center"><br> <p align="center"><br> <!-- Order Method Table --> </p> <table border="0" cellspacing="0" width=400> <tr> <td align="center" colspan="5" bgcolor="#CCFFFF"><font size="4"><b>Choose Order Method:</b></font></td> </tr> <tr> <td align="center" colspan="5" bgcolor="#CCFFFF"> <font size="2">Phone Call: <input type="radio" name="order_type" value="phone"></font> </td> </tr> <tr> <td align="center" colspan="5" bgcolor="#CCFFFF"><a href="options.htm" target=navigate> </td> </tr> </table> <p><br> <p><br> <p align="center"><br> <input type="button" value="Place Order" onclick="orderSubmit('order')"> <input type="reset" value="Reset Address Details"> </p> </form> </td></table> </center> </p> </body > </html> I hate posting that much code. I think though that it might be related to: Code: function orderSubmit(type) { if (type == 'order') {if ( ! ( (document.order.order_type.checked) || checkRequired() )) { // checkCardNumber(); ENTRY HERE alert('first true'); document.order.form_action.value = type; document.order.submit(); return true; } else { alert('first false'); return false; } } } But I am not quiet sure. ANy help I may get is greatly appreciated as the site is very close to going live and this is my BIG problem. |