Model class names and HTML ID attribute

I have extended Yii’s LoginForm model inside a module to setup a login page for the backend admin module.

The module’s LoginForm model is named BackendLoginForm.php. However, the problem I am experiencing now is that in the login form HTML, the login and password fields are now using a different ID… so the ID of the username field is now changed to BackendLoginForm_username as follows:

<input name="BackendLoginForm[username]" id="BackendLoginForm_username" type="text"/>

The above code was auto-generated with Yii’s activeform from the following PHP code:

<?php echo $form->textField($loginFormModel, 'username', array()); ?>

The newly generated IDs means I need to update all the CSS code to make sure the page is displayed correctly, as the CSS is looking for an ID like this "LoginForm_username" instead of this "BackendLoginForm_username".

Is there a way to change the BackendLoginForm.php class so that it outputs LoginForm.username as the element ID/name?

Many thanks!

Maybe not so helpful right now, but you really should use CSS classes instead of setting styles for ID’s. I briefly checked the form sources and could not immediately identify a quick way to hack this,

Yeah, I agree, should use classes in the CSS instead of IDs. We’re making the changes to it now… Fortunately, it was only fields in the login form and registration form where we used IDs instead of classes.

Thanks for your assistance!