1 of 2
1
How Do I add more fields to my contact form?!!! please HELP!
Posted: 18 April 2006 10:31 PM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  266
Joined  03-20-2006

hi…
I know this is really dumb, but I couldn’t find an answer.
I created a from based on the code here : http://expressionengine.com/docs/modules/email/contact_form.html

It sort of work, but it returns most of the fields empty.
Am I missing something?

this is the code:

{exp:email:contact_form user_recipients="false" recipients="atiosis@gmail.com" charset="utf-8"}

<input type=hidden id="subject" name="course" value="{exp:weblog:entries}{title}{/exp:weblog:entries}">

<
label for="from">First Name:</label><br />
<
input type="text" id="name" name="name" size="40" maxlength="35" value="" /><br><br>

<
label for="from">Last Name:</label><br />
<
input type="text" id="last name" name="last name" size="40" maxlength="35" value="" /><br><br>

<
label for="from">Organization:</label><br />
<
input type="text" id="Last-name" name="last-name" size="40" maxlength="35" value="" /><br><br>

<
label for="from">Your Email:</label><br />
<
input type="text" id="from" name="from" size="40" maxlength="35" value="{member_email}" /><br><br>

<
label for="subject">Title</label><br />
<
input type="text" id="subject" name="subject" size="40" value="Contact Form" /><br><br>

<
label for="message">Message:</label><br />
<
textarea id="message" name="message" rows="18" cols="40">Support Email from: {member_name}
Sent at
: {current_time format="%Y %m %d"}</textarea><br><br>

<
input name="submit" type='submit' value='Submit Form' /><br><br>

{/exp:email:contact_form}

Please, I’ll appreciate any help.
thanks!

 Signature 
Profile
 
 
Posted: 19 April 2006 07:40 AM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  24513
Joined  05-20-2002

With EE’s contact form, you only have available the EE variables specified in the docs.  So- name=‘last-name’, for example, won’t be parsed.

What you need to do with all of those fields that don’t correspond to an EE variable is send them in the message[] array.  So- something more like:

{exp:email:contact_form user_recipients="false" recipients="atiosis@gmail.com" charset="utf-8"}

<input type=hidden id="subject" name="message[]" value="{exp:weblog:entries}{title}{/exp:weblog:entries}">

<
label for="from">First Name:</label><br />
<
input type="text" id="name" name="message[]" size="40" maxlength="35" value="" /><br><br>

<
label for="from">Last Name:</label><br />
<
input type="text" id="last name" name="message[]" size="40" maxlength="35" value="" /><br><br>

<
label for="from">Organization:</label><br />
<
input type="text" id="Last-name" name="message[]" size="40" maxlength="35" value="" /><br><br>

<
label for="from">Your Email:</label><br />
<
input type="text" id="from" name="from" size="40" maxlength="35" value="{member_email}" /><br><br>

<
label for="subject">Title</label><br />
<
input type="text" id="subject" name="subject" size="40" value="Contact Form" /><br><br>

<
label for="message">Message:</label><br />
<
textarea id="message" name="message[]" rows="18" cols="40">Support Email from: {member_name}
Sent at
: {current_time format="%Y %m %d"}</textarea><br><br>

<
input name="submit" type='submit' value='Submit Form' /><br><br>

{/exp:email:contact_form}

I just did a quick run through on that- but give it a try and see if it’s closer to what you need.

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 19 April 2006 07:42 AM   [ Ignore ]   [ # 2 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  16148
Joined  04-29-2002

As an alternative to the built in EE contact form, consider using the SolSpace FreeForm module. It writes the records out into a database table inside of EE, and send you an email with the form values.

 Signature 

Most Recent version: 1.6.7 Build 20090515 If needed, also update your forum EE Trial Options - EE Wiki - Docs for updating a build

Profile
MSG
 
 
Posted: 19 April 2006 10:58 AM   [ Ignore ]   [ # 3 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  266
Joined  03-20-2006

Hi!!
sorry for the delay on the reply, but I had problems at home with the internet. (long story)

I watched at the solspace stuff.. it seems a little bit complicated for me, actually, the site itself is a little bit confusing or difficult to browse…. but who am I to critize that. wink

I am actually fooling around with sending the info in the message[]; which seems to be working so far for me…
if it is possible to suggest to EE that for future versions, it would be nice if they make the contact form a little bit more flexible… as everything they do. smile

thanks a lot for the help. If I run into a problem I will post again..
you are the best.

atiosis

 Signature 
Profile
 
 
Posted: 19 April 2006 12:35 PM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  266
Joined  03-20-2006

ok.. I am back again.
it seems to work nice adding all the information in the message as rob said.
now the problem is that I want the field to be required[], so that the user won’t be able to leave the field empty.
well… is not working. I have being testing the form, and when i leave those fields empty, the email still go thru….

this is the new code for my contact form:

{exp:email:contact_form user_recipients=“false” recipients=“atiosis@gmail.com” charset=“utf-8” return=“http://131.94.118.103/expengine/index.php?/modeling_training/modeling_training/”}

<input type=hidden id=“subject” name=“subject” value=“REGISTRATION FOR: {exp:weblog:entries}{title}{/exp:weblog:entries}”>
<input type=hidden id=“sent time” name=“message[]” value=“Request sent on: {current_time format="%Y %m %d"}”>

<input type=hidden id=“first-name-” name=“required[]” value=“FIRST NAME:”>
First Name:

<input type=“text” id=“first-name” name=“required[]” size=“40” maxlength=“35” value=”” /><br>


<input type=hidden id=“last-name-” name=“required[]” value=“LAST NAME:”>
Last Name:

<input type=“text” id=“last-name” name=“required[]” size=“40” maxlength=“35” value=”” /><br>


<input type=hidden id=“organization-” name=“required[]” value=“ORGANIZATION:”>
Organization:

<input type=“text” id=“organization” name=“required[]” size=“40” maxlength=“35” value=”” /><br>


<label for=“from”>Your Email:</label>

<input type=“text” id=“email” name=“from” size=“40” maxlength=“35” value=”{member_email}” /><br>


<input type=hidden id=“title” name=“message[]” value=“TITLE:”>
<label for=“message”>Title:</label>

<input type=“text” id=“title” name=“message[]” size=“40” value=”” /><br>


<input type=hidden id=“complete-address” name=“message[]” value=“ADDRESS:”>
<label for=“message”>Address:</label>

<input type=“text” id=“adress” name=“message[]” size=“40” value=”” /><br>


<label for=“message”>City:</label>

<input type=“text” id=“city” name=“message[]” size=“40” value=”” /><br>


<label for=“message”>State:</label>

<input type=“text” id=“state” name=“message[]” size=“40” value=“FL” /><br>


<label for=“message”>Zip:</label>

<input type=“text” id=“zip” name=“message[]” size=“40” value=”” /><br>


<input type=hidden id=“telephone-number” name=“message[]” value=“TELEPHONE:”>
<label for=“message”>Telephone:</label>

<input type=“text” id=“telephone” name=“message[]” size=“40” value=”” /><br>


<input type=hidden id=“fax-number” name=“message[]” value=“FAX:”>
<label for=“message”>Fax:</label>

<input type=“text” id=“fax” name=“message[]” size=“40” value=”” /><br>


<input type=hidden id=“comments” name=“message[]” value=“ADDITIONAL COMMENTS:”>
<label for=“message”>Additional Comments:</label>

<textarea id=“message” name=“message[]” rows=“18” cols=“40”></textarea>

<input name=“submit” type=‘submit’ value=‘Submit Form’ /><br>


{/exp:email:contact_form}

 Signature 
Profile
 
 
Posted: 19 April 2006 12:37 PM   [ Ignore ]   [ # 5 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  266
Joined  03-20-2006

ok.. I am back again.
it seems to work nice adding all the information in the message as rob said.
now the problem is that I want the field to be required[], so that the user won’t be able to leave the field empty.
well… is not working. I have being testing the form, and when i leave those fields empty, the email still go thru….

this is the new code for my contact form:

{exp:email:contact_form user_recipients="false" recipients="atiosis@gmail.com" charset="utf-8" return="http://131.94.118.103/expengine/index.php?/modeling_training/modeling_training/"}

<input type=hidden id="subject" name="subject" value="REGISTRATION FOR: {exp:weblog:entries}{title}{/exp:weblog:entries}">
<
input type=hidden id="sent time" name="message[]" value="Request sent on: {current_time format="%Y %m %d"}">

<
input type=hidden id="first-name-" name="required[]" value="FIRST NAME:">
First Name:<br>
<
input type="text" id="first-name" name="required[]" size="40" maxlength="35" value="" /><br><br>

<
input type=hidden id="last-name-" name="required[]" value="LAST NAME:">
Last Name:<br>
<
input type="text" id="last-name" name="required[]" size="40" maxlength="35" value="" /><br><br>

<
input type=hidden id="organization-" name="required[]" value="ORGANIZATION:">
Organization:<br>
<
input type="text" id="organization" name="required[]" size="40" maxlength="35" value="" /><br><br>

<
label for="from">Your Email:</label><br />
<
input type="text" id="email" name="from" size="40" maxlength="35" value="{member_email}" /><br><br>

<
input type=hidden id="title" name="message[]" value="TITLE:">
<
label for="message">Title:</label><br />
<
input type="text" id="title" name="message[]" size="40" value="" /><br><br>

<
input type=hidden id="complete-address" name="message[]" value="ADDRESS:">
<
label for="message">Address:</label><br />
<
input type="text" id="adress" name="message[]" size="40" value="" /><br><br>

<
label for="message">City:</label><br />
<
input type="text" id="city" name="message[]" size="40" value="" /><br><br>

<
label for="message">State:</label><br />
<
input type="text" id="state" name="message[]" size="40" value="FL" /><br><br>

<
label for="message">Zip:</label><br />
<
input type="text" id="zip" name="message[]" size="40" value="" /><br><br>

<
input type=hidden id="telephone-number" name="message[]" value="TELEPHONE:">
<
label for="message">Telephone:</label><br />
<
input type="text" id="telephone" name="message[]" size="40" value="" /><br><br>

<
input type=hidden id="fax-number" name="message[]" value="FAX:">
<
label for="message">Fax:</label><br />
<
input type="text" id="fax" name="message[]" size="40" value="" /><br><br>

<
input type=hidden id="comments" name="message[]" value="ADDITIONAL COMMENTS:">
<
label for="message">Additional Comments:</label><br />
<
textarea id="message" name="message[]" rows="18" cols="40"></textarea><br><br>

<
input name="submit" type='submit' value='Submit Form' /><br><br>

{/exp:email:contact_form}

Am I missing something there? any suggestions?
please help smile

 Signature 
Profile
 
 
Posted: 19 April 2006 12:48 PM   [ Ignore ]   [ # 6 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  16148
Joined  04-29-2002

Here’s a sample form using FreeForm:

The required fields are in the first line - name, email, phone1, phone2, city

I could have put in more.

notify goes to the email address you want to receive the data.

return is what templategroup/template you return to after saving the form.

form_name is the name of the form, so you can have multiples in your database.

So you can have more than one form per site.

{exp:freeform:form form_name="njdui" required="name,email,phone1,phone2,city" notify="you@yourdomain.com" return="templategroup/template"}

<fieldset>
<
legend>New Jersey DUI</legend>
<
br />

<
label for="name"><span class=red>*</span> Your Name:</label><br />
<
input name="name" size="30">
<
br /><br />
<
label for="email"><span class=red>*</span> Email:</label><br />
<
input name="email" size="20">
<
br /><br />
<
label for="phone1"><span class=red>*</span> Daytime Phone:</label><br />
<
input name="phone1" size="20">
<
br />
<
br />
<
label for="phone2"><span class=red>*</span> Evening Phone:</label><br />
<
input name="phone2" size="20">
<
br />
<
br />
<
label for="city"><span class=red>*</span> City Where Arrested:</label><br />
<
input name="city" size="20">
<
br />
<
br />

<
label for "county">County Where Arrested:</label><br />
<
select name="county" id="county" tabindex="5">
         <
option value="0">-- Select ---</option>
         <
option value="Essex">Essex</option>
         <
option value="Union">Union</option>
         <
option value="Passaic">Passaic</option>
         <
option value="Bergen">Bergen</option>
         <
option value="Morris">Morris</option>
         <
option value="OtherNJ">Other New Jersey county</option>
         <
option value="OtherState">I was cited in another state</option>
       </
select>
<
br />
<
br />
<
label for="comment">
Additional comments about your DUI<br />arrest that you think are important:</label><br />
<
textarea name="comment" rows="4" cols="35"></textarea>
<
br /><br />
<
div align=center>
<
input type="submit" value="Give Me My Free Consultation!" name="Submit"></div>
</
fieldset>
{/exp:freeform:form}

As far as SolSpace’s site goes, click Software. You’ll need to be logged in to see his downloads.

I haven’t bothered with the EE contact form since I discovered how easy it was to work with the SolSpace module.

 Signature 

Most Recent version: 1.6.7 Build 20090515 If needed, also update your forum EE Trial Options - EE Wiki - Docs for updating a build

Profile
MSG
 
 
Posted: 19 April 2006 12:59 PM   [ Ignore ]   [ # 7 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  266
Joined  03-20-2006

LOL you win.
I’ll go and download their form.
I might be making more posts then. wink

 Signature 
Profile
 
 
Posted: 19 April 2006 01:04 PM   [ Ignore ]   [ # 8 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  16148
Joined  04-29-2002

Told ya. smile

No problem, it’s easy to support that module.

 Signature 

Most Recent version: 1.6.7 Build 20090515 If needed, also update your forum EE Trial Options - EE Wiki - Docs for updating a build

Profile
MSG
 
 
Posted: 19 April 2006 01:05 PM   [ Ignore ]   [ # 9 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  266
Joined  03-20-2006

in the meanwhile.. I have another question:
do I have to deal with the database to do set their form?
because I don’t know anything about database :(

 Signature 
Profile
 
 
Posted: 19 April 2006 01:23 PM   [ Ignore ]   [ # 10 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  2936
Joined  12-06-2002

Does the Solspace module still only allow one use of the form per member?  IIRC you had to use an older version to not have that restriction.

 Signature 

Upcoming ExpressionEngine Classes:
Portland, OR starting 7/13

Profile
 
 
Posted: 19 April 2006 01:34 PM   [ Ignore ]   [ # 11 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  266
Joined  03-20-2006

hey.. it was really easy to install.. smile
thanks..
I am going to be working with it. If I run into a problem I’ll let you know.

Thanks a lot!!
:D

 Signature 
Profile
 
 
Posted: 19 April 2006 02:01 PM   [ Ignore ]   [ # 12 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  266
Joined  03-20-2006

ok. couple of questions about the form:
how do I remove from the subject the: Freeform Posting:

and also, how do I remove all that data that comes along with the email:

author_id: 1
group_id: 1
entry_date: 1145488990
edit_date: 1145488990

je je je je je
told you. I am messy.

 Signature 
Profile
 
 
Posted: 19 April 2006 03:42 PM   [ Ignore ]   [ # 13 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  266
Joined  03-20-2006

?????
PLEASE HELP!

 Signature 
Profile
 
 
Posted: 19 April 2006 07:56 PM   [ Ignore ]   [ # 14 ]  
Grad Student
Avatar
Rank
Total Posts:  58
Joined  10-16-2005

I just had to solve the same problem, so I’ll share my solution. You need to modify mod.freeform.php, starting on line 507 (line number applies to the current version - 1.6)


original code:

$email_subject= 'Freeform Posting: '.$form_name;
$email_message= '';
foreach (
$data as $key => $val)
{
$email_message
.= $key.': '.$val."\n";
}

to change the subject, remove author_id, group_id, edit_date, and convert entry_date in to human-readable format:

$email_subject= 'Your Desired Email Subject Line';
$email_message= '';
foreach (
$data as $key => $val)
{
if ($key == 'author_id' || $key == 'group_id' || $key == 'edit_date') {
continue;
} elseif ($key == 'entry_date') {
$val
=$LOC->set_human_time($val);
}

$email_message
.= $key.': '.$val."\n";
}

Always make a backup copy of mod.freeform.php before you change anything!
Credit goes to Sue for the tip on date formatting:
Howto modify the freeform module to send human friendly time fields

 Signature 

Lunchbox Collective, LLC
http://www.lunchboxcollective.com


“We produce websites worth talking about.”

Profile
 
 
Posted: 19 April 2006 09:42 PM   [ Ignore ]   [ # 15 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  16148
Joined  04-29-2002
Boyink - 19 April 2006 01:23 PM

Does the Solspace module still only allow one use of the form per member?  IIRC you had to use an older version to not have that restriction.

Michael, the version I’m using 1.6 does allow for duplicates.

FreeForm Test

This is even running on EECore.

 Signature 

Most Recent version: 1.6.7 Build 20090515 If needed, also update your forum EE Trial Options - EE Wiki - Docs for updating a build

Profile
MSG
 
 
Posted: 19 April 2006 10:05 PM   [ Ignore ]   [ # 16 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  266
Joined  03-20-2006

hey thanks.
I will trying that later on.
In the meanwhil I decided to keep constructing the website, and then go back to the forms.

thanks a lot for your suggestions and help.
I’ll post again if I run into a new problem smile

ato

 Signature 
Profile
 
 
Posted: 20 April 2006 04:29 PM   [ Ignore ]   [ # 17 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  345
Joined  09-30-2003
Sue Crocker - 19 April 2006 09:42 PM

FreeForm Test

Sue - i tried your form which has a Comments field, but I don’t receive the comments in the email that is sent to me, nor are the comments added to the freform database. What do i need to adjust? (do you receive the comments on your test ?

Profile
 
 
Posted: 20 April 2006 04:57 PM   [ Ignore ]   [ # 18 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  266
Joined  03-20-2006

what I did is to create my own comments field on the module panel. that worked. smile

 Signature 
Profile
 
 
   
1 of 2
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 77533 Total Logged-in Users: 49
Total Topics: 101540 Total Anonymous Users: 28
Total Replies: 544314 Total Guests: 294
Total Posts: 645854    
Members ( View Memberlist )