JavaScript - Javascript Math With Html Forms
Hello everyone at CodingForums!
This is my first post on this site and I would really appreciate any help I can get, First off, all I am trying to do is have someone enter one value into a field then another value into the second field, then have javascript subtract those numbers. This is my first time trying to do something on my own without tutorial help, so I am for the most part just stumbling in the dark. here is what I have thus far: Code: <script type="text/javascript"> <!-- var lastMonth; var thisMonth; function diff(form) { var difference; difference = lastMonth - thisMonth; form.Fdiff.value = difference; } function SetLast(usuage) { lastMonth = usuage.value; } function SetThis(usuage2) { thisMonth = usuage2.value; } // --> </script> <center> <form method="post"> <TABLE border=3> <tr> <tr> <td><p>Last Months <br /> Usuage</p></td> <td><p>This Months <br /> Usuage</p></td> <td><p>Difference</p></td> <TD><INPUT TYPE=BUTTON ONCLICK="diff(this.form)" VALUE="Calculate"></TD> </tr> <tr> </tr> <td><p><input type=text name=lastMonth size="4" onchange="SetLast(usuage)"></p></td> <td><p><input type=text name=thisMonth size="4" onchange="SetThis(usuage2)"></p></td> <td><p><INPUT TYPE=text NAME="Fdiff" VALUE="" SIZE="6"></p></TD> <TD><p></p></tr> </tr> </tr> </table> </form> </center> </center> I'm going off of the code found at this site "http://www.javascriptkit.com/script/cut141.shtml" for a calorie counter. the way the code is now, I get a NaN in the difference box. Again, I would appropriate ANY help and guidance you guys could provide. Thanks Similar Tutorialshey guys, just wondering if u could help me out i'm writing a form for ordering pizza and i'm using a button to submit the info with an onclick event handler. for some reason it won't call the function that i want it to when the submit button is click. here is the code any idea what i'm doing wrong???? <html> <body> <form name="form1" action="popup" method="get"> <fieldset> <legend>Pizza Order form</legend> <p>Write in a First name</P> <input type="text" size="20" maxlength="50" name="firstName"></p> <p>Write in a last name (or surname):<br> <input type="text" size="20" maxlength="50" name="surName"></p> <p>Write in an email address:<br> <input type="text" size ="20" maxlegth="50 name="address"> <p>Are you a previous customer?:<br> <select name="precust"> <option selected>- - - - - - Select one - - - - - -</option> <option value="Yes">Yes</option> <option value="No">No</option> </select></p> <p>pickup or delivery:<br> <select name="delivery"> <option selected>- - - - - - Select one - - - - - -</option> <option value="pickup">pickup</option> <option value="dilivery">delivery</option> </select></p> <p>size:<br> <select name="size"> <option selected>- - - - - - Select one - - - - - -</option> <option value="small">small</option> <option value="medium">medium</option> <option value="large">large</option> <option value="XL">extra large</option> </select></p> <p>number of pizzas:<br> <select name="num"> <option selected>- - - - - - Select one - - - - - -</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select></p> <p>Toppings:<br> Bacon <input type="checkbox" name="bacon" value="bacon"><br> extra cheese <input type="checkbox" name="xcheese" value="extra cheese"><br> olives<input type="checkbox" name="olives" value="olives"><br> pepperoni<input type="checkbox" name="pepperoni" value="pepperoni"><br> mushrooms<input type="checkbox" name="mushrooms" value="mushrooms"><br> green pepper<input type="checkbox" name="gpepper" value="green pepper"><br> red pepper<input type="checkbox" name="rpepper" value="redpepper"><br> sausage <input type="checkbox" name="sausage" value="sausage"><br> ham<input type="checkbox" name="ham" value="ham"><br> pineapple<input type="checkbox" name="pineapple" value="pineapple"><br><br> <input type=button name="hawaiian" value="hawaiian" onclick=' document.form1.ham.checked = true; document.form1.mushrooms.checked = true; document.form1.pineapple.checked = true; document.form1.bacon.checked = false; document.form1.gpepper.checked = false; document.form1.rpepper.checked = false; document.form1.olives.checked = false; document.form1.pepperoni.checked = false; document.form1.sausage.checked = false; document.form1.xchees.checked = false; '> <input type=button name="meatlovers" value="meatlovers" onclick=' document.form1.ham.checked = false; document.form1.mushrooms.checked = false; document.form1.pineapple.checked = true; document.form1.bacon.checked = false; document.form1.gpepper.checked = true; document.form1.rpepper.checked = true; document.form1.olives.checked = true; document.form1.pepperoni.checked = false; document.form1.sausage.checked = false; document.form1.xcheese.checked = false; '> <input type=button name="vegetarian" value="vegetarian" onclick=' document.form1.ham.checked = true; document.form1.mushrooms.checked = false; document.form1.pineapple.checked = false; document.form1.bacon.checked = true; document.form1.gpepper.checked = false; document.form1.rpepper.checked = false; document.form1.olives = "unchecked" document.form1.pepperoni.checked = true; document.form1.sausage.checked = true; document.form1.xcheese.checked = false'> <p><input type=button name="submit" value="Submit" onclick='submit()'></p> </fieldset> </form> <script type="text/javascript" language="Javascript" > function submit() { var fname = document.form1.firstname.value; var lname = document.form1.surname.value; var address = document.form1.address.value; var size = document.form1.size.value; var num = document.form1.num.value; var delivery = document.form1.delivery.value; var precust = document.form1.precust.value; var price; var message; if(document.form1.size.value == "small"){price=5} if(document.form1.size.value == "medium"){price=8} if(document.form1.size.value == "large"){price=10} if(document.form1.size.value == "XL"){price=13} price = price * num; if(document.form1.precust.value == "yes"){price=price*0.9} if(document.form1.delivery.value == "delivery"){price=price+4} message = "Thank you " + fname + " " + lname; message += "You ordered " + document.form1.num.value + " " + document.form1.size.value + " pizzas. "; message += "Your total price is $" + price; var r=confirm(message);// displays the message in a pop-up return(1); } </script> </html> I just have a quick question.... Is it possible to use Javascript to set the name of a tag to be the tag's id? For example, something like this: Code: <input type="text" id="textInput" name="this.id"> The example code above doesn't work. The reason I'm asking is because I have a complex form that uses Javascript to change ids a lot (the input fields are dynamically created). When I was coding the form I completely overlooked the fact I need to use the name tag to process it with PHP. (to enter it into a mysql database) It'd be a pain to have to go through all my javascript and change the name where ever I change the ids. If need be, I'll do this, but I'm just looking for an easier way. Thanks in advance! Hey guys, I use a newsletter service called Aweber to handle my blog's subscription service. What I have right now is a simple HTML form that I can have pass its variables through to a thank you page, so I can add customization there. The web form looks like this: Name: ________________ Email: ________________ Choose a free gift!: drop down list with "gift1" "gift2" or "gift3" as the choices. When a user submits the form, it will bring them to a custom thank you page, which I have made as "thank-you.php". On the "thank you" page, there is a javascript code that was given by Aweber which basically loads up all the variables... you can then CALL all of the variables in the page like this: <script type="text/javascript">formData.display("name")</script> ========================== So what's my question? I wanted there to be a display on the bottom that would allow users to download a different gift based on whether they chose gift 1, 2 or 3. I would also love to have there be an image of the ebook next to the download link depending on which book they chose. Is there a way I can pass variables through into an html <img> tag? (i.e. src="http://www.website.com/formData.display("gift").jpg" ... or something like that). Building off this, how would I generate a different download link based on the choice they made in the web form? (i.e. <a href="http://www.website.com/formData.display("gift").pdf"> or similar) Hopefully this all makes sense, let me know if you can help! Hello folks! This is my first time posting here, and I am relatively new to JavaScript. I have come in need of assistance in guiding me in the right direction. My intentions are to create a web-based page where one can select from a few drop down menu's, and enter a few select pieces of information. This information would then be logged for later purposes, when the user chooses to retrieve this information (during the initial usage, no long term storage) in the format of a report. Would anyone have sources to similar coded applications, or any ideas of the directions I can go in for further assistance. I have at this point been utilizing the W3 website to learn. Thanks a ton! I have a web page with two forms, when I click the button on one of the forms, the onclick event goes to a javascript that emails the first form and then the second form. This is correct, this is the way I want this to work. It's simple, it's easy, it works! However, it only works in FireFox and Internet Explorer, it will not work in Google Chrome browser. I've spent many hours trying lots of various ways to implement this so I'm not interested in speculating about possible solutions that might work, I've already tried too many of those. Also, it needs to work this way, not combining the forms, etc. Does anyone have any tried and tested solutions that work with Chrome? Thanks, in advance, for your expert advice. I know I can always rely on EE when all else fails. I know somebody here can solve this problem. Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=windows-1250"> <title></title> </head> <body> <form id="NameForm" method="post" action="mailto:yourFirstemail@email.com"> Name: <input type="text" size="10" name="name"> <br /> <input onclick=functionCaller() type="button" value="Submit Two Forms"> </form> <form id="AddressForm" name="DComments" method="post" action="mailto:yourSecondemail@email.com"> Address: <input type="text" size="10" name="address"> <br /> </form> <script type="text/javascript"> <!-- function functionCaller() { document.getElementById('NameForm').submit(); document.getElementById('AddressForm').submit(); } --> </script> </body> </html> I'm new to programming and can't figure out why this won't work: Code: print " var 1A == Math.sqrt(Math.pow(B,2) - Math.pow(C,2)); \n"; print " var 1B == Math.sqrt(Math.pow(A,2) + Math.pow((F + G),2)); \n"; print " var 1C == B + D; \n"; print " var 1D == C - B; \n"; print " var 1E == E; \n"; print " var 1F == (Math.sqrt(Math.pow(C,2) - Math.pow(A,2)) - G); \n"; print " var 1G == (Math.sqrt(Math.pow(C,2) + Math.pow(A,2)) - F); \n"; print " var 1H == ((F + G) / B); \n"; I have tried debugging it using Firebug and I get this error: Quote: identifier starts immediately after numeric literal I get the error on the line with var 1A, but I'm pretty sure that 1B, 1F, and 1G would all have the same error. Thanks for the help in advance guys! BTW the reason why the code is being printed is because I'm programming with Perl and running on a webpage using html and javascript. ok so heres where I stand, I don't know too much about javascript. Just enough to get me by. I am a PHP developer, I know how to do this in PHP but the client insists on doing it through javascript. Basically there are 3 different form values that determine the Premium Death Benefit Ratio. This is the formula the client wants: Premium to Death Benefit Ratio % (Created by formula = Annual (Level) Premium Amount (Divided by) Death Benefit Amount (equals a percentage) That percentage multiplied by Life Expectancy The 3 form values in the formula would be Annual Premium Amount (fypremium), Death Benefit Amount (dbp), Life Expectancy (average_le) I was messing around with javascript trying to figure it out and I have gotten no where since I am not used to writing formulas in JS. Anyways here is what I have so far: Code: function calculateLE(inputFieldId1, inputFieldId2, inputFieldId3, outputFieldId){ var DBR; var input = document.getElementById(inputFieldId).value; APA = document.getElementById(fypremium).value; DBA = document.getElementById(dbp).value; LE = document.getElementById(average_le).value; formula = document.getElementById(fypremium).value / document.getElementById(dbp).value = formula3; formula2 = document.getElementById(average_le).value * formula3; if { APA = "" } { document.getElementById(outputFieldId).value = "Error getting Annual Premium Amount"; } else if { DBA = "" } { document.getElementById(outputFieldId).value = "Error getting Death Benefit Amount"; } else if { LE = "" } { document.getElementById(outputFieldId).value = "Error getting Life Expectancy"; } else { document.getElementById(outputFieldId).value = formula3; } } Now I honestly have no clue if I am on the right track but what i've found on the net hasnt really pointed me in the right direction Here is the form values. Code: <input type="text" name="fypremium" id="fypremium" onblur="calculateLE('fypremium', 'dbp', 'average_le', 'premium_dbr')"> <input type="text" name="dbp" id="dbp" onblur="calculateLE('fypremium', 'dbp', 'average_le', 'premium_dbr')"> <input type="text" name="average_le" id="average_le" onblur="calculateLE('fypremium', 'dbp', 'average_le', 'premium_dbr')"> In a nut shell the values for the 3 inputs stated above will determine premium_dbr's value. fypremium / dbp = percentage; average_le * percentage = DBR (death benefit ratio); If someone could point me in the right direction to finishing this id be very greatful. Hi all, I have a website that allows users to enter complex mathematical formulas into a text field and evaluates them. I am currently using eval() because it not only can handle all the standard mathematical functions, but also gives them access to the Math object. That way the users can use functions such as Math.max() and everything else. I realize, though, that using eval is evil, I assume because a malicious user might throw in some more damaging javascript that would be run without checking it. (That's why eval is evil, right?) Is there a way that I can allow my users to construct complex mathematical formulas and use the Math object (or an equivalent) without potentially opening my site up to harm? Not sure if this is possible in javascript: I'm looking for two different dates (bill date and due date) on an invoice that are captured by OCR. If one of them exists, but the other does not, I want the empty field to be 14 days before (or after) the other. For example: if the bill date is 7/27/2010 and the due date was not captured, I want to set the due date as 8/10/2010 (14 days after the bill date). If the due date was captured as 8/10/2010, but the due date is blank, I want to assign the bill date as 7/27/2010 (14 days before the due date). if both dates have values, do nothing. Thanks. I'm having a total brain fart as to why this is happening. I just transferred my company's website from aplus.net servers to a linux based server on GoDaddy. My company's "shop" page has a drop down menu which should automatically re-direct you to a different page (on a different website where our shopping cart is hosted) when the option is selected. For some reason, after the switch to a different host, the option tags are no longer re-directing to the proper pages. Instead, they just tack on the value URL onto the existing URL and i just go in circles. javascript: <script language="JavaScript" type="/text/javascript"> function nav() { var w = document.myform.mylist.selectedindex.html; var url_add = document.myform.mylist.options[w].value; window.location.href = url_add; } </script> HTML for options form: <FORM NAME="myform"> <SELECT NAME="mylist" onChange="nav()"> <OPTION VALUE="http://bedvoyage.com/shop">Select Your Product <OPTION VALUE="http://bedvoyage.myshopify.com/products/twin-sheet-set">Sheet Set - Twin - $139.00 <OPTION VALUE="http://bedvoyage.myshopify.com/products/double-sheet-set">Sheet Set - Double - $159.00 <OPTION VALUE="http://bedvoyage.myshopify.com/products/queen-sheet-set">Sheet Set - Queen - $179.00 <OPTION VALUE="http://bedvoyage.myshopify.com/products/king-sheet-set">Sheet Set - King - $199.00 <OPTION VALUE="http://bedvoyage.myshopify.com/products/twin-pillow-case">Pillow Case - Twin - $20.00 <OPTION VALUE="http://bedvoyage.myshopify.com/products/double-pillow-case">Pillow Case Set - Double - $40.00 <OPTION VALUE="http://bedvoyage.myshopify.com/products/queen-pillow-case">Pillow Case Set - Queen - $42.00 <OPTION VALUE="http://bedvoyage.myshopify.com/products/king-pillow-case">Pillow Case Set - King - $45.00 <option value="http://bedvoyage.myshopify.com/products/zippered-travel-pillow-case">Zippered Travel Pillow Case - $19.00 <!-- <OPTION VALUE="http://bedvoyage.myshopify.com/produ...uot;>Travel Blanket - $39.00 --> </SELECT> </FORM> Is there an option on godaddy that i'm just missing out on that i'm too ignorant to notice? Thanks in advance. When I click Vacant after 5 and it goes to occupied. How would I make it come back to vacant when clicked again? Code: <html> <head> <script type="text/javascript"> function fillForm() { if (counter > 10){ } } </script> <script type="text/javascript"> function StartCounting(){ setInterval("DoCounting()", 1000) } var Counter = 0; function DoCounting(){ var obj = document.getElementById('countingtext'); obj.innerHTML = '' + Counter; Counter++; if( Counter > 5) { var obj1 = document.getElementById("closed").value = "Open"; var space1 = document.getElementById("space1") space1.onclick = linkClick; } } function linkClick(){ space1 = document.getElementById("space1").value = "Occupied"; } </script> </head> <body onload= "StartCounting()"> Open at 5: <span id="countingtext"></span> </body> </html> <div style="margin-right:3mm; " > <form action="#" method="post" id="theForm" > <input size="10" id="closed" value="Closed" style="text-align:center;" /> <script type="text/javascript"> </script> <input type='button' id="space1" name='s"+ i+"' value='Vacant' onclick='readSpace(s"+ i+")' style='width:15mm;' /></td> </form> </div> Currently I have the following script:- Code: function validate_form(){ if(regform.reguser.value == ""){ alert("Please completed the selected box"); regform.reguser.focus(); return false; }else if(regform.regemail.value == ""){ alert("Please completed the selected box"); regform.regemail.focus(); return false; }else if(regform.regpass1.value == ""){ alert("Please completed the selected box"); regform.regpass1.focus(); return false; }else if(regform.regpass2.value == ""){ alert("Please completed the selected box"); regform.regpass2.focus(); return false; }else{ return true; } } to validate a simple registration form, however I initially tried to streamline this function by cycling through an array using a loop to point to various input elements in the HTML page itself. I found that when trying to use a variable in the aforementioned if statements the javascript failed to work i.e. Code: var test = "reguser"; if(regform.test.value = ""){ } I know the javascript is looking for the input element "test" instead of "reguser" but is there any way I can force it to look for the contents of the variable. I cannot get the result right. I write area and phone by numbers but it still gives me error Code: function validate_text(field,alerttext) { with(field) { var re = /[a-zA-Z]/g; if(re.test(field)) { return true;}else{alert(alerttext);return false;} } } function validate_number(field,alerttext){ with(field) { var re = /[0-9]/g; if(re.test(field)) { return true;}else{alert(alerttext);return false;} } } function validateForm(thisForm){ with(thisForm) { if(validate_number(area,"wrong area code") == false) { area.focus();return false; } if(validate_number(phone,"wrong phone") == false) { phone.focus();return false; } if(validate_text(name_surname,"wrong name") == false) { name_surname.focus();return false; } } } Code: ...<b>Name Surname :</b><input style="margin-left:10px;" type="text" name="name_surname"/> <br /><br /> <b>phone :</b><input type="text" style="margin-left:19px;" maxlength="4" size="4" name="area" /> -<input type="text" style="margin-left:5px;" maxlength="7" size="10" name="phone" /><br /><br />.... I have found a code to help me learn how to add forms in javascript, but it's limited to text input forms. Code: <script type="text/javascript"><!-- function updatesum() { document.form.sum.value = (document.form.sum1.value -0) + (document.form.sum2.value -0); } //--></script> Where the inputs sum1 and sum2 are text fields you put whatever numbers you want in. That works fine. Great. Now what I'm having trouble with is modifying the code so that it will add one form with an input number with a form that spits out a randomly generated number. Code: <input type="button" value="D20" onclick="this.form.display.value = Math.round (20 * Math.random())" class="buttonHi" /> <input name="display" type="text" size="6" value="" /> This is what I'm using for my random number generator. So basically I want to be able to put, say, 5, into the input text field above this. And then click on the d20 button to get a random number, say, 15, and then have the first code add the inputted 5 with the randomly generated 15. Is this possible? Hello, I need to solve the following task on my website: I have products with add to cart button, like this: Code: <form action="cart.php" method="post" id="_cart" name="_cart"> <input type="hidden" name="prodid" value="Product1" /> <a href="javascript: AddToCart()"> <img src="/images/design/buynow.gif" /> </a> </form> However, it doesn't work, since i have the same value under the name of each form: "_cart". Is there any way i still can send a form regardless the name of the form? I tried to use "onclick", like this: Code: <a href="javascript: void(0);" onclick="document._cart[0].submit();return false;"> However, i still have to change the value under the _cart element from 0 to the number of my forms. I need just submit a form itself, with the same form names. For some reason i cannt use the html submit button. Everything should be done with JavaScript. I beleive this text is not hard for understanding ) Look forward to your help Guys. Hi, I am very new to Javascript and am having some difficulties with implementing two forms on the same page. The page in question is http://www.devoteddomains.com/contac...ed-domains.asp. The form at the top appears on every page and works on all of the other pages except this one. When you try to complete the form it validates the second form on the page. The code for the top form can be found he http://www.devoteddomains.com/web-de...vices-cta.html (it is an include file). The two scripts that I am using are as follows: Top Form: http://www.devoteddomains.com/scripts/scripts.js Contact Page Form: http://www.devoteddomains.com/scripts2/scripts.js Can someone please help! Cheers, Peter i am new to JavaScript and i have an assignment to create a tour calculator here is the code and its not working please help its urgent thanks. [code] <!DOCTYPE> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> .font { font-size: 28pt; } font2 { font-size: 15pt; } </style> </head> <body> <strong class="font">USA Tour Cost Calculator</strong> <br/> <br/> Conplete the form below to calculate the cost of your tour of the United States <script type="text/javascript"> function calculate(){ var cost=0; var accomodation=0 var radio1 var radio2 var duration=0 function accomodation() { for (var i=1; i<=3; i++) {radio1= document.getElementById("radio"+i); if (radio1.checked==true) {accomodation=i;}} if (accomodation=1){cost=parseInt(radio.value); return value;} else if (accomodation=2){cost=parseInt(radio.value); return value;} else if (accomodation=3) {cost=parseInt(radio.value);return value;} else {window.alert("Please select the type of accomodation")} } function peak() { var cost=accomodation() var peak=document.getElementById("check1") if (peak.checked==true) {cost +=parseInt(checkbox.value); return value;} else {cost=accomodation()} } function calc(){ var cost=peak() for (var i=1; i<=4; i++){ radio2=document.getElementById("Radiobutton"+i); if (radio2.checked==true) {duration=i;} if (duration=1) {cost*=parseInt(radio.value); return value;} else if (duraion=2){cost*=parseInt(radio.value); return value;} else if(duration=3) {cost*=parseInt(radio.value); return value;} else if(duration=4){caost*=parseInt(radio.value); return value;} else {alert("Please select the duration of tour")} } } </script> <br/> <form id="form2" name="form2" method="post" action=""> <p> <label> <input type="radio" name="RadioGroup2" value="95" id="Radio1" /> Camping</label> <br /> <label> <input type="radio" name="RadioGroup2" value="140" id="Radio2" /> Budget Hotel</label> <br /> <label> <input type="radio" name="RadioGroup2" value="170" id="Radio3" /> Premier Hotel</label> <br /> </p> </form> Click here if you will be travelling during the peak season of June to August: <input name="" type="checkbox" value="20" id="check1" /> <br/> <br/> Duration of tour: <form id="form1" name="form1" method="post" action=""> <label> <input type="radio" name="RadioGroup1" value="4" id="Radiobutton1" /> 4 days, 1sate</label> <br /> <label> <input type="radio" name="RadioGroup1" value="7" id="Radiobutton2" /> 7 dasy, 3 states</label> <br /> <label> <input type="radio" name="RadioGroup1" value="14" id="Radiobutton3" /> 14 days, 12 states</label> <br /> <label> <input type="radio" name="RadioGroup1" value="20" id="Radiobutton4" /> 20 days, 18 states</label> <br /> </p> </form> <br/> <p> <input type="submit" value="Calculate" onClick='alert("The total cost of your tour is $calculate();")'><input type="reset" value="Reset" /></p> </body> </html> [code] Hello, this is my first post here, but I'm having some trouble figuring out what I messed up on my code I'm making a Javascript game of Hangman for one of my classes and I originally had the input as a text box where you physically type in the letter and if it was wrong, it would draw the next sequence of the hangman picture and place the letter in another text box as a "Used Letters," or if you're right, it would place the letter you chose in the box for the word you're guessing. However, I decided that instead of doing that, I wanted to make it more visually appealing and add buttons with the letters on them instead. As you can see in the code which is down-loadable here (the one with the _2 is the one I'm currently using, but the original is supplied as well), the buttons register for the picture changing, but do not register for the "Used Letters" field or for filling in the actual word. One of the button's values is also replaced by "undefined" after each click of another button and I'm not really sure why If anyone could take a look at my code and see if you can figure out what the deal is, that'd be awesome! Hi, I am trying to produce a form which customers fill in to acquire a car park permit for my car park. In the form, I take details of reg plate, make and model, colour etc, and also take the period of time they are paying for (1-6 months) and the date in which they want their permit to start (either immediately or they select the date from the calendar). I was trying to implement a script that I found online into my form so that it will show them on the form when the expiry date of their new permit will be. However, when I try to use the script, and click on the button that I produced to work out the expiry date, it submits the form and takes them to checkout without filling out the expiry date. Please can someone help me?! Kind Regards, Dan. |