Jump to content

Change additional domainfield to placeholder


JelleG

Recommended Posts

Hi,

 

Currently inside the cart file /templates/orderforms/template/configuredomains.tpl I want to change the

{$domainfield}

.

 

This is currently load like the following:

 

<input type="text" name="domainfield[0][0]" value="" size="20" class="form-control input-250 input-inline"> * Personal Identification Number (or Organization number), if you are an individual registrant (or organization) in Sweden

 

I want to load the field information, that is currently load after the <input> as a placeholder.

 

How can I change this, so this is load as a placeholder?

Link to comment
Share on other sites

How can I change this, so this is load as a placeholder?

with difficulty!

 

if you had just wanted to use {$domainfieldname} as the placeholder, then that would have been easier - you would have just needed to replace...

 

                            <div class="col-sm-8">{$domainfield}</div>

with...

 

                            <div class="col-sm-8">{if $domainfield|strpos:'<input type="text"'===0}{$domainfield|replace:"/>":" placeholder=\"`$domainfieldname`\"/>"}{else}{$domainfield}{/if}</div>

however, you want to use part of the variable output as the placeholder value - that's slightly trickier to do and requires more advanced Smarty coding..

 

                            {assign domainph $domainfield|replace:"/>":" placeholder=\"{$domainfield|strstr:'/>'|replace:'/>'|substr:1}\"/>"|strstr:'/>':true|cat:'/>'}
                           <div class="col-sm-8">
                               {if $domainfield|strpos:'<input type="text"'===0}
                                   {if $domainph|strstr:'placeholder=""'}
                                       {$domainfield|replace:"/>":" placeholder=\"`$domainfieldname`\"/>"}
                                   {else}
                                       {$domainph}
                                   {/if}
                               {else}
                                   {$domainfield}
                               {/if}
                           </div>

what this will do is first check if the output is a text field - if it's not (dropdown, checkbox etc), it will output the field as normal; if it is a text field, it will use the additional domain field description (if one exists) as the placeholder... if there is no description (tested with .fr as some fields there have no descriptors), then it uses $domainfieldname as a placeholder... you can change that to leave it empty if that's what you want to do.

 

i've quickly tested this on .nu (your example TLD) and it works fine...

 

09OvTXQ.png

 

and for .fr/.ru too. :idea:

x8tHT4s.png

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