Jump to content

SkipLabel form field and field type password (not InputfieldPassword)


pwFoo
 Share

Recommended Posts

skipLabel

I try to skip the form field label, but don't get it working...

Field is based on an array

array(
                'type'          => 'submit',
                'value'         => $this->_('Login'),
                'id'            => 'submit',
                'name'          => 'submit',
                'skipLabel'     => Inputfield::skipLabelHeader,
            ) 

Second try... getthe form field an set it after added to the form.

$submit = $this->form->get('submit');
$submit->set('skipLabel', 2); // Inputfield::skipLabelHeader;

https://processwire.com/talk/topic/5488-checkbox-other-text-in-header-than-label-text/?p=53528

https://processwire.com/talk/topic/2089-create-simple-forms-using-api/?p=69445

type password

I try to build a login form, but there seems no way to set it the field information array

            array(
                'type'      => 'text',  // 'password'  <-- InputfieldPassword != type password 
                'label'     => $this->_('Password'),
                'name'      => 'password', 
                'id'        => 'password',
                'name'      => 'password',
                'required'  => true,
            )

As solution I get the field from the form and modify it, but is there a clean way to define it?

        $passField = $this->form->get('password');
        $passField->attr('type', 'password');
Link to comment
Share on other sites

  • 1 year later...

Hello,

I have the same problem today and done this to solve that:

$your_field->label = ''; //first need to set field label as empty string (important!)
$your_field->skipLabel = true; //works only if the label is set to empty string

regards.

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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