hogava Posted November 16, 2019 Share Posted November 16, 2019 Hello How can we add css class to custom fields in register page? now we use this: {foreach $customfields as $customfield} <div class="control"> {$customfield.input} </div> {/foreach} Now I want the output to be something like this: <input type="email" name="email" id="inputEmail" class="my custom class" placeholder="my place holder" value=""> thanks. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 16, 2019 Share Posted November 16, 2019 37 minutes ago, hogava said: How can we add css class to custom fields in register page? the customfields already have a class assigned to them, so you're really replacing what's already there by changing the class. 54 minutes ago, hogava said: Now I want the output to be something like this: a bad example as that isn't a customfield, but I get the gist - for something like this, you have at least 3 options... edit the clientregister.tpl template and use a Smarty replace... {if $customfield.id eq 42}{$customfield.input|replace:'class="form-control"':'class="form-control2" placeholder="place holder"'}{else}{$customfield.input}{/if} so in this example for CF42, I am changing the CSS class and adding a placeholder - for other customfields, it does nothing... though you can have multiple if statements, in_arrays etc to cover whatever conditions/changes that you need to do. use a ClientAreaPageRegister hook, loop through the $customfields array (these input fields are just html strings) and use multiple replaces on the input fields and then return the updated array back to the template. use jQuery in a ClientAreaFooterOutput hook to change the class and add the placeholder to each CF field you want to change. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.