pwFoo Posted April 10, 2015 Share Posted April 10, 2015 How to disable the InputfieldPassword input fields? $pass = $form->get('password'); $pass->attr('disabled', true); With the example above the password field is disabled, but the "confirm" input field is enabled. Link to comment Share on other sites More sharing options...
adrian Posted April 10, 2015 Share Posted April 10, 2015 Not sure your exact scenario, but I have made use of: $this->addHookBefore('InputfieldPassword::processInput', $this, 'removeRequired'); public function removeRequired(HookEvent $event) { $event->object->required = false; //hack to remove required status on password field } From memory it's not possible to set the status of the password field directly to not required. I know this is not the same as disabled, but now you should be able to disable or hide it and should work as expected I think. One thing to keep in mind, the system password field is actually named "pass", not "password" like you have there. 2 Link to comment Share on other sites More sharing options...
pwFoo Posted April 10, 2015 Author Share Posted April 10, 2015 Hi Adrian, thank you for your reply, but that is not what I need. If you set InputfieldPassword to hidden or disabled only the password field named password will be affected, but there is a second field (confirmation!) named _password. Here you can see the markup generated by InputfieldPassword (only input elements). <p><input id="password" class=" required" name="password" type="password" size="50" maxlength="256" disabled="1" /></p> <p><input type='password' size='50' name='_password' value='' /> <span class='detail'>(confirm)</span></p> Haven't found a way to disable both fields via field settings. Link to comment Share on other sites More sharing options...
pwFoo Posted April 12, 2015 Author Share Posted April 12, 2015 Solved by a hook to remove required and than the hole field from the form. It was the easiest way... Thanks Adrian. Link to comment Share on other sites More sharing options...
Can Posted December 15, 2016 Share Posted December 15, 2016 Would be nice if password field were actually made required by field settings, but thanks a lot for the hook adrian just wanted to unrequire pass field because not all user need a pass as some might only be staff entry to show on the front page and I just confirmed that an empty password wont allow login..I like! maybe it could be deactivatable in advanced mode 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now