Jump to content

Popup contact form depending on button pressed


Endorphin

Recommended Posts

Hi All,

 

I have been looking for hours for a solution but no joy so far.

 

I have a contact page with different names on, each name has its own contact button.

I am trying to find a way to produce a standard popup contact form but send it to the required name, address and individual subject line.

 

I don't really want to use the mailto function, I'm sure there must be an easy solution but my skills are very limited.

 

Any help would be appreciated.

 

Neil :confused:

There are plenty of tutorials, demos, and source code on how to achieve this.  Here is a site that provides 16 different form fields with demos and tutorials on how to build them:

http://www.webresourcesdepot.com/16-free-ajax-contact-forms-for-a-better-user-experience/

 

If you are still having trouble getting it to work, come back with your code and we'll help you.

You could create a contact form for each different person and then display the necessary contact form when the 'contact this person' link is clicked. This could be done with a little JavaScript.

 

function setState(id, state)
{
document.getElementById(id).style.display = state;
}

 

You would then give each form and id or wrap a div around each with an id like

<div id="form1">

 

All of the forms will need to be set in CSS so that they are not displayed:

#form1, #form2, #form3 {
display:none;
}

 

Then we need to invoke the JS function when the link is clicked:

 

<a href="#" onclick="return false" onmousedown="setState('form1','block');setState('form2','none');setState('form3','none');">Display form1</a>

 

The code above will create a link that will set form1 to visibly display on the screen whilst closing any of the other forms. the onclick="return false" prevents the link from refreshing the page or redirecting.

 

Hope I helped

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.