Jump to content

Require filling the field "Address 2"


Recommended Posts

exactly what/how would depend on your orderform template, but if we assume it's standard_cart, then one quick way to do it would be to change in checkout.tpl..

 

<input type="text" name="address2" id="inputAddress2" class="field" placeholder="{$LANG.orderForm.streetAddress2}" value="{$clientsdetails.address2}"{if $loggedin} readonly="readonly"{/if}>

to...

<input type="text" name="address2" id="inputAddress2" class="field" placeholder="{$LANG.orderForm.streetAddress2}" value="{$clientsdetails.address2}"{if $loggedin} readonly="readonly"{else}required{/if}>

it would probably fail in IE9, but then again, I imagine a lot of WHMCS features would fail in IE9 !

Link to comment
Share on other sites

Hello,

 

I also made a hook in php to force "address2" to be a required field.

This way it is safer and works for any area where this address is inserted or modified.

 

function hook_validation_account($vars) {

   if (!$vars['address2']) {
       $error[] = "You did not enter 'Address 2'";
   }

   if($error){
       return $error;
   }
}

add_hook("ClientDetailsValidation",1,"hook_validation_account");

Link to comment
Share on other sites

Hi brian,

For tax reasons here in my country, I need certain fields to be required.

I'm using this hook for other things too, like checking the personal identification number here from Brazil (CPF).

 

And these required fields need to be filled out. And this is required even for admin.

 

I'm seeing the error of my own hook, the one I set in "$error[]". But although the error appears, the modification is performed anyway.

And I do not want even the administrator to be able to set an invalid CPF. Or leave "Address 2" blank.

 

Thank you!

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