GetSimple Support Forum

Full Version: Making a custom p01-contact form
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
I posted over in the plugins section but have not had any response so I thought I'd try here - I'll delete that post if I get a solution here.

I'm trying to add a custom contact form to one of my pages (not the theme). I was creating a component and then trying to add the component to the page but it seems I cannot add the PHP call to include the component.

What is the best way to create a custom contact form to include in only one page and has anyone an example? I don't want to add it to the template and I'd like to avoid using EXEC-PHP if possible.

Sample fields that I intended to use via a component are:

(% contact : blah@example.com,
subject => Feedback,
name,
email,
radio "OK to publish your comments on our website?" = "Yes" | "No" selected,
radio "OK to associate your name with comments on our website?" = "Yes" | "No" selected,
select = "One" selected | "Two" | "Three" | "Four" | "Five" ,
message = Any Further Comments?,
captcha,
askcopy %)

Any help/guidance much appreciated.

Ronan
Edit the page where you want to have a contact form, and just paste below code, and modify labels:
Code:
(% contact: blah@example.com,subject => Feedback,name "your name",email "your e-mail",radio "OK to publish your comments on our website?" = "Yes" | "No" selected,radio "OK to associate your name with comments on our website?" = "Yes" | "No" selected, select = "One" selected | "Two" | "Three" | "Four" | "Five", message! "Additional comments ?",captcha,askcopy %)
Thanks Joe!

My 1 main sins were:

1. Message was followed by an '=' rather than '!'
2. My code was split across multiple lines with line breaks which meant it wasn't being interpreted correctly

2 final questions I hope ...

1. Is it possible to have 2 contact forms on a single page, however, for both to have different captcha values?
2. Can you pass parameters to the fields so they are auto populated e.g. I want to send out an email to customers and I want things like name, email etc already pre populated when they click on the link?

Regards,

Ronan
! sign means that data inside input field is important, so the field needs to be filled.

ad1. you can have multiple contact forms, although I wouldn't use captcha.
There's also math captcha available in p01 contact plugin, and imo it's a better solution than letter captcha.
Personally I don't use any sort of captcha solution. P01 works fine without it, as it's protected pretty well from spamcrawlers.

ad2. you'd need to create a javascript function, and check what value has been chosen from select list, and then fill another input with proper value. Jquery or even javascript snippets may be easily found.
You can look at this fiddle to have at least something to begin with: http://jsfiddle.net/WLacb/10/
All,

I've had good success implementing the above suggestions but have 2 further questions ...

1. I can't seem to make a radio button a required field, even thou I have specified radio!

2. I have added the option to have a copy sent to the email address supplied, but only when the checkbox has been selected. I appears even when the user does request a copy be sent to them buy placing a check in the box, they still receive a copy of the the form.

Any suggestions?

Ronan
Hi guys,

Sorry for bumping, any suggestions for my problem above?

Ronan
Sorry that reopen this old thread but i think it is good to do.

I would like to ask what i can to to set another different message to the option of the p01-contact for.

If i use email!"my e-mail" i can set different description to this option.

Is it possible to do that with the "askcopy" option tooo?

Currently i use standard "german" installation with I18N multilanguare option
and i like to update this to the english form but that standard output only
german if i canĀ“t add differemt description.

Look on my current version online link to page
Hope anyone can help.

Harald