Welcome, Guest. Please login or register.
Did you miss your activation email?
May 25, 2012, 03:38:24 PM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155508 Posts in 21711 Topics by 7737 Members
Latest Member: simpleguy
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Small change to Form module  (Read 469 times)
smilie

Offline Offline

Posts: 1


« on: August 16, 2009, 04:52:33 PM »

Hi,

This is primarily for the creators of the Form module (or people who maintain it), but it may be used by anyone else as well. Maybe to add it as standard in next release?

I do not guarantee for any consequences of your website / WB installation due to the following change smiley

When using Form on the website, you can pre-define content of the text field and text area. I wanted my visitors to have that pre-defined text cleared once they click on the text field or text area. It is a very small change to do it.

This is tested on WB version 2.8:
Edit modules/form/view.php on line 192 change:
Code:
$values[] = '<input type="text" name="field'.$field_id.'" id="field'.$field_id.'" maxlength="'.$field['extra'].'" value="'.(isset($_SESSION['field'.$field_id])?$_SESSION['field'.$fiel    d_id]:$value).'" class="textfield" />';
to:
Code:
$values[] = '<input type="text" onclick="this.value=\'\'" name="field'.$field_id.'" id="field'.$field_id.'" maxlength="'.$field['extra'].'" value="'.(isset($_SESSION['field'.$field_id])?$_SESSION['field'.$fiel    d_id]:$value).'" class="textfield" />';

Change is only addition of: onclick="this.value=\'\'" in that line. This is for text field.

In the same file, for text area, change line 195:
Code:
$values[] = '<textarea name="field'.$field_id.'" id="field'.$field_id.'" class="textarea" cols="25" rows="5">'.(isset($_SESSION['field'.$field_id])?$_SESSION['field'.$field_id]:$value    ).'</textarea>';
to:
Code:
$values[] = '<textarea name="field'.$field_id.'" id="field'.$field_id.'" class="textarea" cols="25" rows="5" onclick="this.value=\'\'">'.(isset($_SESSION['field'.$field_id])?$_SESSION['field'.$field_id]:$value    ).'</textarea>';
As you can see, same code = onclick="this.value=\'\'" has been added here as well.

Save file and you are ready to go smiley

Cheers,
Aleks
Logged
lausianne
WebsiteBaker Org e.V.

Offline Offline

Posts: 155


WWW
« Reply #1 on: August 18, 2009, 07:22:58 AM »


I vote in favour of adding this as an option. Sometimes text should stay in the field, e.g. standard mail message text that would be edited by the user, not replaced completely. But mostly I would like text to be cleared, too, like adress, phone number etc.

Cheers,
Ralf.
Logged
tom@media3lv.com

Offline Offline

Posts: 4


« Reply #2 on: January 21, 2010, 08:48:03 PM »

I too vote for this addition to the next release!!!  I have been wanting this option for a long time, but don't have the php moxy to add it in like this:)


Tom
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!