Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populate Data in email response form

Status
Not open for further replies.

rbwallis

Technical User
Aug 28, 2018
4
US
I have seen some rental sites where, the info about a property is shown. When a client clicks on a "contact" button, a form pops up to send an email to the property owner that they are interested. This email includes the property address from the listing.How can I get this to happen?
EXAMPLE:
Landlord enters property details in a form.
Form is saved and displayed on the site, with a "Contact" button.

I want the renter to be able to send an email with the property address and the landlord's email populated (from landlord's previously entered data).
 
Can you share examples of the sites you have observed? There are many ways to do this.

Contact forms are more often produced with server side scripting (not js)... js is only used to make the form pop up.
 
That is going to be a lengthy explanation as it depends on a bunch of things, key of which is how your website is being built to display the properties, and how the contact form is being shown.

The more straightforward way to do this, is to include an ID in the Contact button that refers to the item being displayed. Then use that ID to pull the info from that entry and add it to the Contact Form wherever it needs to go.

While it can be done with Js and ajax, it still requires a server side script to get the data if the data comes from a database.

Alternatively if the entries are just static HTML, then you would need to include all the relevant data in the button's action or URL its opening.

You would then use a server side script to get the data from the URL, and print it into the form inputs as required.

Again JS is not really involved here much outside of maybe showing the form or redirecting to the page that has the form.

In other words, this is not going to be just add a couple JS tags and it works. We would need to know exactly how your website works to give you a more functional answer.

----------------------------------
Phil AKA Vacunita
----------------------------------
OS-ception: Running Linux on a Virtual Machine in Windows which itself is running in a Virtual Machine on Mac OSx.

Web & Tech
 
Thanks for all of your help so far. Sorry this is so confusing. The part I'm having trouble with is, when the renter sees a listing and wants more information, they click on a button and the problem is trying to get the email to open up with the landlord's email and property address already populated.
 
Vacunita:

What kind of server side script would I need?
 
Rent.com does not use js to prepopulate the form. This is clearly done via server-side scripting, of which there are many options:

Additionally, I'm not seeing any values prepopulated in the form elements of rent.com's message system. The property identification is likely maintained in a session variable, which certainly requires server-side scripting.

If you "want the renter to be able to send an email with the property address and the landlord's email populated", we should be discussing how you are displaying a property. I assume it is coming from a database and you have a server-side script rendering it to the HTML, right? If so, you'll need to build on to that server side scripting.
 
What kind of server side script would I need?

One that would pre-populate the form based on how your website is built.


All rent.com really does, is know what property you are asking about, and add some default text to the message.

Again, you would need to have your contact button have an ID or the property information and then use that in the server side script to get the relevant info for the property into the form.

Rent doesn't actually send an email, it probably has an internal messaging system to contact the landlords. The form is likely being built yes with some Javascript, but also some Ajax possibly to get the relevant data from the server to add to the popup form.

In any case, as I said, this is not just a bit of code and it works, you need to build the script based on how your website is constructed, how the information is presented before the contact button is clicked, and what server side scripting language your server currently supports or is running for your website.

Does the server support ASP, PHP, Dreamweaver? Something else entirely? We can't just spit out code at you and have it work.

We would need to know how your website works, how your properties are displayed, etc...










----------------------------------
Phil AKA Vacunita
----------------------------------
OS-ception: Running Linux on a Virtual Machine in Windows which itself is running in a Virtual Machine on Mac OSx.

Web & Tech
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top