Jump to content

how change style of custom fields?


hogava

Recommended Posts

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.

Link to comment
Share on other sites

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...

  1. 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.

  2. 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.

  3. use jQuery in a ClientAreaFooterOutput hook to change the class and add the placeholder to each CF field you want to change.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated