Topic: telephone number input Pages that link to <a href="https://ozoneasylum.com/backlink?for=31987" title="Pages that link to Topic: telephone number input" rel="nofollow" >Topic: telephone number input\

 
Author Thread
I X I
Paranoid (IV) Inmate

From: beyond the gray sky
Insane since: Apr 2004

IP logged posted posted 09-17-2010 22:39 Edit Quote

hi all. I'm having some trouble and was hoping someone might be able to help me out.

I've been using php and mysql for a long time, and I always used server side validation, but I never really looked at JS much. Getting back into web design for the first time in a while, I've decided to try JS for client-side validation. I have found a few examples, and have started working on a more advanced contact form. I'm making progress, but I've hit a hitch.

the javascript I have so far is -

code:
function validate_phone(current, destination) {
    current.value=current.value.replace(/[^\d]/,'');
    if (current.getAttribute&&current.value.length ==
        current.getAttribute("maxlength")){
        destination.focus();
    destination.select();
    }
}



and the html -

code:
<input type="text" id="areaCode" size="2" maxlength="3"
    onkeyup="validate_phone(this, document.contact.prefix);">
<label>&#41;&nbsp;</label>
<input type="text" id="prefix" size="2" maxlength="3"
    onkeyup="validate_phone(this, document.contact.suffix);">
<label>&#45;</label>
<input type="text" id="suffix" size="3" maxlength="4"
    onkeyup="validate_phone(this, document.contact.body);">



it works as intended going forward, but the problem I'm having is if you enter a wrong number, editing a full input box becomes tricky. I'm not sure how to handle this.

any insight would be great. also, if anyone knows a good resource for regular expressions in javascript I'd love to see it. regex has always been a mystery to me, but I know it will be useful when validating input.

[edit]
edited for overflow;



Some people say I'm a dreamer, but I'm not the only one (John Lennon)

(Edited by I X I on 09-17-2010 22:43)

I X I
Paranoid (IV) Inmate

From: beyond the gray sky
Insane since: Apr 2004

IP logged posted posted 09-25-2010 11:26 Edit Quote

over a week and not a single reply =(

I remember when I first joined. a single day's quickchanges would fill up 2 pages or more. now it seems an entire week's barely fills a single page.



I know the pieces fit, 'cause I watched them fall away (Maynard J. Keenan)

Tao
Maniac (V) Inmate

From: The Pool Of Life
Insane since: Nov 2003

IP logged posted posted 09-26-2010 16:29 Edit Quote

I remember when it was all fields.
Sorry I can't help you with your troubles.

I X I
Paranoid (IV) Inmate

From: beyond the gray sky
Insane since: Apr 2004

IP logged posted posted 10-02-2010 13:23 Edit Quote

well, I gave up on trying to get the "auto tab" feature to work.

if I could get a couple volunteers to head over to www.athometech.info/contact.php and send me some messages to test out the latest incarnation of my contact form, I'd greatly appreciate it.

thanks bunches =)



You know I'd like to keep my cheeks dry today, so stay with me and I'll have it made (Shannon Hoon)

WebShaman
Lunatic (VI) Mad Scientist

From: The Happy Hunting Grounds...
Insane since: Mar 2001

IP logged posted posted 10-02-2010 22:00 Edit Quote

What the hell is a blind melon, anyways?

WebShaman | The keenest sorrow (and greatest truth) is to recognize ourselves as the sole cause of all our adversities.
- Sophocles

I X I
Paranoid (IV) Inmate

From: beyond the gray sky
Insane since: Apr 2004

IP logged posted posted 10-02-2010 23:59 Edit Quote

from http://en.wikipedia.org/wiki/Blind_Melon#Naming_of_the_band

quote:
Naming of the band

It's most likely that Blind Melon is some form of reference to the 1920s' Blues artist Blind Lemon Jefferson. Cheech & Chong had an act involving a character named Blind Melon Chitlin nt which was itself a reference to Blind Lemon. Another story states that the band took its name from the bassist Brad's father, who teased the band calling them "Blind Melons" number2. Even if this story is the true inspiration, the father almost certainly took the reference from either the early blues artist or the skit in parody of him. The reference to Blind Lemon Jefferson also fits the band's blues-influenced style.



so mr webshaman, did you find my contact page in good working order?



Take your time, hurry up; the choice is yours just don't be late (Kurt Cobain)

Tao
Maniac (V) Inmate

From: The Pool Of Life
Insane since: Nov 2003

IP logged posted posted 10-03-2010 01:16 Edit Quote
quote:

I X I said:

if I could get a couple volunteers to head over to www.athometech.info/contact.php and send me some messages to test out the latest incarnation of my contact form, I'd greatly appreciate it.


Done

I X I
Paranoid (IV) Inmate

From: beyond the gray sky
Insane since: Apr 2004

IP logged posted posted 10-03-2010 03:23 Edit Quote

message received.

did you have any trouble with anything? and did you test my input validation methods (try a "bad" email address or letters in the phone number field)?

I'd like to make sure this is going to hold up. I'm not storing any of this information in a database, so I don't think I'll have to worry about injection... I'm curious if there's any way that this page could cause me grief if used improperly. I've never actually operated a website that had a function, just my own personal "playgrounds" to test my skills and learn from. any guidance would be helpful =)



Life is too short, so love the one you got (Bradley Nowell)

coach
Nervous Wreck (II) Inmate

From:
Insane since: May 2011

IP logged posted posted 05-31-2011 11:00 Edit Quote
Edit TP: spam removed


Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu