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

Prefill data


  1. pixel
    Member

    I have created a specific form for one customer and I would like to input into the form like customer , name, address, phone, email, that the same customer will not have to repeat every time, only section that he needs to fill, I read a couple posts down "Post Data to Table" is this a similar procedure or need to be different

    Posted 16 years ago #
  2. yuniar

    Umm.. no, that's not the same.

    If this form is just a specific form for one customer, you might better set the default values for some of those fields. So that your customer won't need to fill it.


    MachForm Founder

    Posted 16 years ago #
  3. pixel
    Member

    will I be able to do in Css file or have to go to php file for that specific form ?

    Posted 16 years ago #
  4. yuniar

    Simply go to your form editor page, click the field and you will see the "Default Value" input box on your field properties. Put the value there.


    MachForm Founder

    Posted 16 years ago #
  5. pixel
    Member

    It worked on single fields, how do I input into Name field and address ,
    is there a html file associated with the form ?

    Posted 16 years ago #
  6. redityo

    Hi,

    To set default value for name and address field, you should edit "view-function.php" file. Let say you have form_id = 7, so try to follow these steps :

    1. Go to line 682 ~ 685, you'll see this code

    //check for guidelines
    if(!empty($element->guidelines)){
    	$guidelines = "<p class=\"guidelines\" id=\"guide_{$element->id}\"><small>{$element->guidelines}</small>
    ";
    }

    add exactly bellow that code

    if ($_GET['id'] == '7') {
    	$element->populated_value['element_'.$element->id.'_1']['default_value'] = "first name";
    	$element->populated_value['element_'.$element->id.'_2']['default_value'] = "second name";
    }

    2. For address element, go to around line 1389 ~ 1394 you will see these code

    foreach ($country as $data){
    	if($data['value'] == $element->default_value){
    		$selected = 'selected="selected"';
    	}else{
    		$selected = '';
    	}

    put the code below that one

    if ($_GET['id'] == '7') {
    $element->populated_value['element_'.$element->id.'_1']['default_value'] = "address 1";
    $element->populated_value['element_'.$element->id.'_2']['default_value'] = "address 2";
    $element->populated_value['element_'.$element->id.'_3']['default_value'] = "city";
    $element->populated_value['element_'.$element->id.'_4']['default_value'] = "state";
    $element->populated_value['element_'.$element->id.'_5']['default_value'] = "zip";
    $element->populated_value['element_'.$element->id.'_6']['default_value'] = "country"; // must same with country drop down value
    }

    MachForm Support

    Posted 16 years ago #

RSS feed for this topic

Reply