This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

[closed] Auto Clear Field


  1. Jerry82
    Member

    How do I get the field default value to disappear when the field is clicked?

    Posted 15 years ago #
  2. redityo

    You need to edit "view-functions.php" file to do that. If you have text field with element id = 1 in form 1, then try to follow these steps :

    1. Go to around line 39 and you'll see this code :

    $element_markup = <<<EOT

    put these code above that line

    if ($_GET['id']  == 1 && $element->id == '1') {
    	$reset_data = "onClick=\"javascript:this.value='';\"";
    }

    2. Go to around line 48, you'll see this code :

    <input id="element_{$element->id}" name="element_{$element->id}"
      class="element text {$element->size}" type="text" value="{$element->default_value}" />

    replace with this one

    <input id="element_{$element->id}" name="element_{$element->id}" {$reset_data}
      class="element text {$element->size}" type="text" value="{$element->default_value}" />

    MachForm Support

    Posted 15 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.