Jump to content

Archived

This topic is now archived and is closed to further replies.

Christopher Short

require phone number

Recommended Posts

As I understand it this should already be required. This is one place in the content.register.php file:

<div class="row">
      <div class="small-12 large-8 columns"><label for="phone" class="show-for-medium-up">{$LANG.address.phone}</label><input type="text" name="phone" id="phone"  value="{$DATA.phone}" placeholder="{$LANG.address.phone} {$LANG.form.required}" required></div>
   </div>

{$LANG.form.required}" required>  should control that.

Share this post


Link to post
Share on other sites
41 minutes ago, Dirty Butter said:

As I understand it this should already be required. This is one place in the content.register.php file:  {$LANG.form.required}" required>  should control that.

That of course depends on what skin you are using but do check that file to see if your skin has that code

Share this post


Link to post
Share on other sites
 

As I understand it this should already be required. This is one place in the content.register.php file:

<div class="row">
      <div class="small-12 large-8 columns"><label for="phone" class="show-for-medium-up">{$LANG.address.phone}</label><input type="text" name="phone" id="phone"  value="{$DATA.phone}" placeholder="{$LANG.address.phone} {$LANG.form.required}" required></div>
   </div>

{$LANG.form.required}" required>  should control that.

Hi Dirty Butter — long time no see! Hope you're fine and dandy.

Would it be possible to alter this line so that a phone number is NOT required? What would be the magic incantation to use? (I don't mind giving people the option to enter their phone if desired — I just don't want it to be obligatory).

Thanks in advance,

Will

Share this post


Link to post
Share on other sites

you could try

<div class="row">
      <div class="small-12 large-8 columns"><label for="phone" class="show-for-medium-up">{$LANG.address.phone}</label><input type="text" name="phone" id="phone"  value="{$DATA.phone}" placeholder="{$LANG.address.phone}"></div>
   </div>

Share this post


Link to post
Share on other sites

Thanks very much for your speedy reply, ayz1.

I replaced the code as you suggested, then cleared image, language, SQL and regular caches in Maintenance area of Admin Dashboard. I also cleared my browser's cache, but I'm still required to enter a phone number (although the placeholder text "(Required)" no longer shows).

As your suggestion is the equivalent to removing the bit of code reading…

{$LANG.form.required}" required

…I can only assume there's some code elsewhere making this required as well.

The labyrinthine network of PHP files that constitutes CubeCart is too obtuse for a simple guy like me, so I can't even begin to tell how to trace where this is coming from. Any more clues?

Thanks in advance and best wishes,

Will

Share this post


Link to post
Share on other sites

Yes it was never going to be that easy. I've tried a few different ways to get it to work. It is a required field in the database and I switched that off. I turned off recapcha and still no joy so like you said there is something else going on somewhere. Hopefully someone with more knowledge than me will have a solution for you.

I removed

    $.validator.addMethod("phone", function(phone, element) {
        phone = phone.replace(/\s+/g, "");
        return this.optional(element) || phone.match(/^[0-9-+()]+$/);
    }, $('#validate_phone').text());
    $.extend(jQuery.validator.messages, {
        required: $('#validate_field_required').text()
    });

from the js/3.cubecart.validate.js file and it allowed registration without a phone number.

Don't know if it has any other implications anywhere but it seems to work.

Share this post


Link to post
Share on other sites
 

I removed

    $.validator.addMethod("phone", function(phone, element) {
        phone = phone.replace(/\s+/g, "");
        return this.optional(element) || phone.match(/^[0-9-+()]+$/);
    }, $('#validate_phone').text());
    $.extend(jQuery.validator.messages, {
        required: $('#validate_field_required').text()
    });

from the js/3.cubecart.validate.js file and it allowed registration without a phone number.

That sounds great, ayz1, except I can't find js/3.cubecart.validate.js. I have a directory called js, but no file called 3.cubecart.validate.js. I might wonder if this depends on what skin I'm using, but directory js isn't within the skins directory.

I'm using the slightly out of dat v.6.0.12 — would that make a difference to the directories used?

Thanks for all your help!

Will

 

Mine still allows people not to enter it...

Hi Christopher – would you mind letting me know what version CC and skin you're using, please? I'm running CC 6.0.12 plus Minimiser as a child of Foundation (it's heavily based on Foundation, apparently).

Thanks for your input.

Will

Share this post


Link to post
Share on other sites
On 17/08/2017 at 2:43 PM, Christopher Short said:

Mine still allows people not to enter it...

Hi Christopher,

Wondering how you achieved this — phone number not being required? Is it to do with the skin you're using and, if so, could you please let me know what skin you have?

Thanks in advance,

Will

Share this post


Link to post
Share on other sites

×
×
  • Create New...