Jump to content

Time Frame Form Field


A Zayed

Recommended Posts

You can use custom field with template.

        $form->add(new \IPS\Helpers\Form\Custom('mytime', $mytime, false, array(
            'getHtml' => function ($element) {
                return \IPS\Theme::i()->getTemplate('fields')->mytimeField('mytime', $element->value);
            }
        )));

And then define a time field in the html template:

<ips:template parameters="$name, $value" />
<div>
    <input type='time' class='ipsField_short' placeholder='' value="{$value}" name="$name">
</div>

 

Link to comment
Share on other sites

18 hours ago, Ryan Ashbrook said:

You can also specify the type of field when using \IPS\Helpers\Form\Text.


$form = new \IPS\Helpers\Form;
$input = new \IPS\Helpers\Form\Text( 'my_field', $value, TRUE );
$input->formType = 'time';
$form->add( $input );

 

Excellent... 

19 hours ago, Sonya* said:

You can use custom field with template.


        $form->add(new \IPS\Helpers\Form\Custom('mytime', $mytime, false, array(
            'getHtml' => function ($element) {
                return \IPS\Theme::i()->getTemplate('fields')->mytimeField('mytime', $element->value);
            }
        )));

And then define a time field in the html template:


<ips:template parameters="$name, $value" />
<div>
    <input type='time' class='ipsField_short' placeholder='' value="{$value}" name="$name">
</div>

 

Didn't use custom form before, will try this solution also

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...