Jump to content

Display field data in a popup.


perficut

Recommended Posts

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]

Link to comment
https://forums.phpfreaks.com/topic/147838-display-field-data-in-a-popup/
Share on other sites

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.