perficut Posted March 4, 2009 Share Posted March 4, 2009 I have an html form which verifies certain fields are filled in. Once the submit button is pressed, a popup window is displayed simply reminding reminding the user that they are about to submit their information to us. What I would like to be able to do, is in this popup window, I would like it to reference the data entered into certain fields. For example. Thank you, $FirstName, for submitting your timesheet on the following property. $PropertyName $Address $City If this is correct, hit OK, if not Press CANCEL to return to the form. Here is the existing code. Im not sure how to reference the data in the fields, and have it displayed correctly. if(retVal == false) { alert('Please correct the errors. Fields marked with an asterisk (*) are required'); return false; } var answer = confirm("ALERT! By submitting this form you agree that this information is accurate and correct. If you are NOT sure press CANCEL now and review the data you entered. Invoices will be generated based on this information. Any changes to this information after submission may lead to non payment. \n \nIN OTHER WORDS... MAKE SURE THIS INFORMATION IS CORRECT") if (answer){ alert("SUBMITTING DATA NOW") } else{ alert("CHECK THE FOLLOWING:\n\n Service Date \n Location \n Arrival Time \n Depart Time \n Salt or Calcium Applied") return retVal=false; }; return retVal; } code] Quote Link to comment Share on other sites More sharing options...
perficut Posted March 4, 2009 Author Share Posted March 4, 2009 anyone? Quote Link to comment Share on other sites More sharing options...
kickstart Posted March 4, 2009 Share Posted March 4, 2009 Hi I think you are confusing php and Javascript. The fragment you posted is Javascript, while the fields you mention are (I think) the php variables that you have put the data in once the form is processed. In Javascript you would want to use the value of the field using the fields id. Eg, if you had <input type='text' id='testField' /> then you would use document.getElementById('testField').value to get its value for use in javascript. Also an ALERT is a bit of a crude way to put up such a question. To give the users a choice you would want to use a CONFIRM (or start playing around with popup divs or dynamically creating / displaying fields from Javascript). All the best Keith Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.