cformsII Support Forum
Current User: Guest *Frequently Asked Questions*
Search 
Search Forums:


 




Remove default value from email

Add a New Topic Reply to Post
Post

Patrick - Guest

9:19 pm - April 2, 2008

  • cforms version: 8.02
  • Your Wordpress version: 2.5

When I use a default value that clears on focus and the user does not change it, it would be nice if there was an option to not have the default value be sent in the email (leave it blank instead).


Also, if I have a regular expression on the field on this same field for when the user does enter a value, I presently have to make the expression match the default value, as it is posted if the user doesn't enter a unique value.

Oliver - Admin

9:44 pm - April 2, 2008

posts 3549

default value that clears on focus..

I see your point but the purpose of the default value is exactly that: being a default value to be sent in case nothing else entered.

With 8.1, you can add titles to your input fields for further 'description' of what is expected, perhaps this may suit your needs?

I presently have to make the expression match the default value

Not sure what you're trying to say...can you give an example?

Patrick - Guest

10:00 pm - April 2, 2008

For a phone number field, I set the default value to xxx-xxx-xxxx to show the user the format I want the number to be entered. To ensure that the number is in this format I tried to use "^(\d{3}-\d{3}-\d{4})+$" (blank, or in the correct form). But since the default value is always present if the user leaves the field blank, I have to use something like this "^[\dx]{3}-[\dx]{3}-[\dx]{4}$".

Oliver - Admin

10:28 pm - April 2, 2008

posts 3549

Got it. I think it does make sense to allow fields that are flagged to clear on focus, to also clear on submission if the value = the default value. Again, it'll be in the next release.

Here is the quick fix:

in lib_ajax.php (~line 155) just before:

// check if fields needs to be cleared

add:

//check if fields needs to be cleared
$obj = explode('|', $field_name,3);
$defaultval = stripslashes($obj[1]);
if ( $params ['field_' . $i] == $defaultval && $field_stat[4]=='1')
$params ['field_' . $i] = '';

in lib_nonajax.php (~line 99) just before:

// check if fields needs to be cleared

add:

// check if fields needs to be cleared
$obj = explode('|', $field_name,3);
$defaultval = stripslashes($obj[1]);
if ( $_POST[$current_field] == $defaultval && $field_stat[4]=='1')
$_POST[$current_field] = '';
Add a New Topic Reply to Post


Reply to Topic: Remove default value from email
PLEASE READ THE FAQs FIRST! THANK YOU.

NOTE: New Posts are subject to administrator approval before being displayed

Guest Name (Required):

Guest EMail (Required):

Guest URL (required)

Math Required!
What is the sum of: 12 + 12        (Required)

Topic Reply:


 
© Simple:Press Forum - Version 3.1.3 (Build 356)