vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Is there a way to do an input mask? (https://vborg.vbsupport.ru/showthread.php?t=39725)

JoshFink 06-11-2002 03:31 PM

Is there a way to do an input mask?
 
I want to have a profile field for Phone Numbers.

I want the phone numbers to be in the format (xxx) xxx-xxxx

I'm curious on how I would do this.

Thanks for the help

Josh

Admin 06-11-2002 04:48 PM

See this in register.php and member.php:
Code:

    // ENTER ANY CUSTOM FIELD VALIDATION HERE!
Put there preg_match statement, and see if the $$varname fits the pattern:
Code:

#\([0-9]{3}\) [0-9]{3}-[0-9]{4}#

JoshFink 06-11-2002 04:53 PM

Thanks, but wouldn't that REQUIRE them to enter in the correct format?

Is there a way so that they just enter 10 digits and it displays it like that?

Thanks

Josh

Admin 06-11-2002 05:22 PM

How do you expect them to enter it?
xxx xxx-xxxx
xxxxxx-xxxx
xxx xxx xxxx
??

Chris M 06-11-2002 06:16 PM

Probably just :

xxxxxxxxxx

Satan

JoshFink 06-11-2002 06:21 PM

xxxxxxxxxx

Should be fine. I think it would be the easiest to format.

Thanks

josh

Admin 06-12-2002 05:21 AM

In register.php and member.php replace this:
Code:

    $$varname=censortext($$varname);
    // ENTER ANY CUSTOM FIELD VALIDATION HERE!

With this:
Code:

    $$varname=censortext($$varname);
        if ($profilefield['profilefieldid'] == XX and preg_match('#[0-9]{10}#', $$varname)) {
                $$varname = '('.substr($$varname, 0, 3).') '.substr($$varname, 3, 3).'-'.substr($$varname, 6);
        }
    // ENTER ANY CUSTOM FIELD VALIDATION HERE!

(Without the spaces; quote this message to see the real source)

JoshFink 06-12-2002 01:15 PM

Thanks for the help, I'll give it a try.

Josh

Chris M 06-12-2002 05:13 PM

Did it work?

Satan


All times are GMT. The time now is 07:44 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01014 seconds
  • Memory Usage 1,722KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete