Jump to content

require phone number


Christopher Short
 Share

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.

Link to comment
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

Link to comment
Share on other sites

  • 1 month later...
 

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

Link to comment
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>

Link to comment
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

Edited by Will Shaman
Link to comment
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.

Link to comment
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

Link to comment
Share on other sites

  • 1 month later...

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.

 Share

×
×
  • Create New...