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

Eliminate "day" requirement from calendar


  1. jlking98
    Member

    I have removed the calender picker/icon from my form and have managed to remove the "day" section from my date fields. However, the form is still requiring that field to be entered. Can you tell me where in the post-functions.php file where I would disable the rules for the "day" requirement?

    Posted 15 years ago #
  2. redityo

    You need to give default value for "day" field to do that. For example you have form id = 1 and date element id = 2, then edit your "view-function.php" and go around line 425 you will see this code :

    $element_markup = <<<EOT

    put this code exactly bellow that line

    if ($_GET['id'] == 1 && $element->id == 2)
    {
    $add_style = 'style="display:none"';
    $element->populated_value['element_'.$element->id.'_1']['default_value'] = "01";
    }

    You also can see in here for my complete post

    http://www.appnitro.com/forums/topic/credit-card-date?replies=5

    MachForm Support

    Posted 15 years ago #
  3. jlking98
    Member

    I revised my form to have dd/mm/yyyy format and then I edited my view-function.php with the suggested code from this post and the complete post above. However, my form is showing the "dd". What am I doing wrong? I have included the code from the view-function.php.

    My form can be viewed here: http://www.landscapepayments.com/machform/view.php?id=1

    if ($_GET['id'] == 9 && $element->id == 1)
    {
    $add_style = 'style="display:none"';
    $element->populated_value['element_'.$element->id.'_1']['default_value'] = "01";
    }
    $element_markup = <<<EOT
    <li id="li_{$element->id}" {$error_class}>
    <label class="description">{$element->title} {$span_required}</label>
    <span {$add_style}>
    <input id="element_{$element->id}_1" name="element_{$element->id}_1" class="element text" size="2" maxlength="2" value="{$element->populated_value['element_'.$element->id.'_1']['default_value']}" type="text" /> /
    <label for="element_{$element->id}_1">{$lang['date_dd']}</label>
    </span>
    <span>
    <input id="element_{$element->id}_2" name="element_{$element->id}_2" class="element text" size="2" maxlength="2" value="{$element->populated_value['element_'.$element->id.'_2']['default_value']}" type="text" /> /
    <label for="element_{$element->id}_2">{$lang['date_mm']}</label>
    </span>
    <span>
    <input id="element_{$element->id}_3" name="element_{$element->id}_3" class="element text" size="4" maxlength="4" value="{$element->populated_value['element_'.$element->id.'_3']['default_value']}" type="text" />
    <label for="element_{$element->id}_3">{$lang['date_yyyy']}</label>
    </span>

    Posted 15 years ago #
  4. redityo

    Hi,

    It seems the problem you've set the wrong condition. Now your condition is :

    if ($_GET['id'] == 9 && $element->id == 1)
    {
    $add_style = 'style="display:none"';
    $element->populated_value['element_'.$element->id.'_1']['default_value'] = "01";
    }

    But when I look to your form it should be like this

    if ($_GET['id'] == 1 && $element->id == 9)
    {
    $add_style = 'style="display:none"';
    $element->populated_value['element_'.$element->id.'_1']['default_value'] = "01";
    }

    and for your information I've reply your mail also, let's continue there if you still have the problem :)


    MachForm Support

    Posted 15 years ago #

RSS feed for this topic

Reply