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

Prepopulate city field


  1. cheryledwards
    Member

    I am using the "Address" field label and because almost all responses will come from our city I would like to prepopulate the city field with our city name, but still have the person able to change the city name if they need to.

    I've looked at loads of posts on the forum but cannot find how to do this.

    Posted 13 years ago #
  2. redityo

    You can edit "includes/view-functions.php" file and go to tound line 1358 for this code :

    global $lang;

    then simply add these code bellow that line

    if (empty($element->populated_value['element_'.$element->id.'_3']['default_value'])) {
    	$element->populated_value['element_'.$element->id.'_3']['default_value'] = "my city";
    }

    you can change "my city" text with your default city name.


    MachForm Support

    Posted 13 years ago #
  3. cheryledwards
    Member

    My form is looking good, but it would look even better if I could get the city, province and postal code on one line (there should be enough room to fit them in).

    How do I do this please? The code is:

    ' <div id="li_14_div_3" class="left">
    <input id="element_14_3" name="element_14_3" class="element text medium" value="Toronto" type="text" />
    <label for="element_14_3">City</label>
    </div>

    <div id="li_14_div_4" class="right">
    <input id="element_14_4" name="element_14_4" class="element text medium" value="ON" type="text" />
    <label for="element_14_4">Province</label>
    </div>

    <div id="li_14_div_5" class="left">
    <input id="element_14_5" name="element_14_5" class="element text medium" maxlength="15" value="" type="text" />
    <label for="element_14_5">Postal code</label>'

    Posted 13 years ago #
  4. yuniar

    Can you let us know the URL to your form please?
    You can send it via email if you don't want to post it here.

    Please send to: customer.service [at] appnitro.com


    MachForm Founder

    Posted 13 years ago #

RSS feed for this topic

Reply