CSS - add class on action button

CSS - add class on action button

by Siddharth Patel -
Number of replies: 3

Hello Moodlers,

I want to add a new class on my submit button of the registration form.

I took reference from various places and changed the following lines in login\signup_form.php:

$this->add_action_buttons(true, "My submit with my class", ['class' => 'myyclass']);

Also used the $attribute logic from: https://docs.moodle.org/dev/lib/formslib.php_Form_Definition#text, but it gave no effect.

Moodle version: 3.8.3
Theme: Klass

Thanks

Average of ratings: -
In reply to Siddharth Patel

Re: CSS - add class on action button

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
In reply to Gareth J Barnard

Re: CSS - add class on action button

by Siddharth Patel -
Thanks for the response.
For attribute logic, I tried two ways.

One with an array:
$attributes=array('size'=>'200','class'=>'muclass');
$this->add_action_buttons(true, "My submit attributes", $attributes);

One with direct variable:
$attributes='class="muclass"';
$this->add_action_buttons(true, "My submit attributes", $attributes);

None of then gave any effect applied. I could not see the class anywhere and also there was no effect on size. Below is the HTML code seen on browser:


Changes made in: \login\signup_form.php

In reply to Siddharth Patel

Re: CSS - add class on action button

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Why can't you just use the CSS selector:

#page-login-signup [name="submitbutton"]