Jump to content

How to change text input placeholder on the radio toggle?


Numbered

Recommended Posts

Example:

        $form->add(
            new \IPS\Helpers\Form\Radio('something', null, true, [
                'options' => [
                    'opt1' => 'val1',
                    'opt2'   => 'val2',
                ],
                'toggles' => [
                    'opt1' => ['text_container'],
                    'opt2' => ['text_container']
                ]
            ])
        );
        $form->add(new \IPS\Helpers\Form\Text('text_input_id', null, true,
            [
                'placeholder' => \IPS\Member::loggedIn()->language()->get('text_input_placeholder'),
                'minLength'   => 1,
                'maxLength'   => 14,
            ],
            function ($val) {
                // not interesting
            }, null, null, 'text_container'));

 

Can i set different placeholder on text input depending on current radio option selected? Or i can do it only with javascript way?

Thanks!

Link to comment
Share on other sites

22 minutes ago, Joy Rex said:

Since you're talking about changing the placeholder text based on the current radio button choice, jQuery/Javascript would be the only way to do that as the user changed the radio button selection.

Thanks for support my assumption. Already start doing in this way

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...