Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Forms____and Characters

  1. #1
    Join Date
    Mar 2006
    Location
    Somewhere....
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Forms____and Characters

    Hi- Me again.

    Just want to know, how do you restrict characters in forms, because for the life of me, I CANT REMEMBER. I know reading a HTML book a while back that there is simple HTML line that just goes in <form tag> itself... ??? Does anyone out there Know?

    I know there must be a javaScript out there that can do this, but thats not what i am looking for though, JuSt ThE aBoVe...



  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I really don't think they have that. A quick Google search turned up nothing (nothing using only HTML). Besides that, I'm reasonably sure I would have come across something like that at least once by now if it existed. Perhaps what you remember seeing was the onchange javascript event that invoked a validation function of one sort or another or something like that. That could look (by itself) like pure HTML.

    Here's being open to being wrong on this one but, I don't think so.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Mar 2006
    Location
    Somewhere....
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Hmmm...Yes

    Yes, but I remember it being put in the tag itself....I am very sure...

    It looked like some type of array <pattern [a-z]> ????? type thing....


    I will have to find that book....

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That's the thing about an onchange or other event, it could look something like so:

    HTML Code:
    <input type="text" onchange="if (/[0-9]/.test(this.value)){this.value=''};">
    That, for instance, would reset the filed to blank if a number were entered and focus were directed away from the input. It is contained in the tag but, this is javascript. If the code for the event were written more economically, or if there were a supporting function elsewhere on or available to the page, more could be done with even less appearing in the tag. Seeing just the portion in the tag could be misleading in such cases.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Mar 2006
    Location
    Somewhere....
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow hmm. possible

    Yeah i guess that's what it looked like.... So i just got mixed up with the java?

    Thankyou for your help, I tried it on my site's forms and it pretty much does
    what i was looking for....


    ..:Oh yes, one last question:..

    ..::Is it posible to customize you text imput areas like you can with
    the submit and clear buttons, with the <INPUT TYPE="submit" onClick="return checkmail(this.form.Email)" value="submit" style="color: Black; background-color: White"> tag atributes?


    And once again Thanks.

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by Samsoske
    Thankyou for your help, I tried it on my site's forms and it pretty much does
    what i was looking for....
    Well, what exactly did you have in mind? You can also use the replace method to simply remove the offending character(s) leaving the rest of the text as entered. This could be done onkeyup instead of onchange. Here is a version for that, it disallows anything except numbers:

    HTML Code:
    <input type="text" onkeyup="value=value.replace(/[^\d]/g, '')">
    Quote Originally Posted by Samsoske

    ..::Is it posible to customize you text imput areas like you can with
    the submit and clear buttons, with the <INPUT TYPE="submit" onClick="return checkmail(this.form.Email)" value="submit" style="color: Black; background-color: White"> tag atributes?
    Sure! One thing to keep in mind with a text input is that if you want to change its height, don't set the height property, instead use the font-size property, that way, not only will the height change but the size of the text typed in will match the size of the input:

    HTML Code:
    <input type="text" style="font-size:.75em;border:1px inset green;">
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Mar 2006
    Location
    Somewhere....
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    <input type="text" style="font-size:.75em;border:1px inset green;">
    If you wanted to change the bgcolor atribute, you would just add bgcolor:#ff66yy; to <input type="text" style="font-size:.75em;border:1px inset green; bgcolor:#ff66yy;"> ???????????????????????

  8. #8
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1
    HTML Code:
    <input type="text" style="font-size:.75em;border:1px inset green;">
    Don't use em lengths for font-size declarations. IE can end up computing the value completely incorrectly. Use percentages:

    HTML Code:
    <input ... style="font-size: 75%;">
    That said, I'd like to note two things:

    1. A reduction to 75% is probably too small. If it's 75% of the default font size, then it should definitely be larger: at least 85%, but preferably larger still.
    2. Don't use in-line style declarations (though I realise in posts like these, it's much more convenient).



    Quote Originally Posted by Samsoske
    If you wanted to change the bgcolor atribute, you would just add bgcolor:#ff66yy; [...]
    No. The property name is background-color. Note that a background colour should be paired with a foreground colour declarations (the color property).

    Mike

  9. #9
    Join Date
    Mar 2006
    Location
    Somewhere....
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Posted By mwinter

    <input ... style="font-size: 75%;">

    I tried it, and you can use the good old

    <input type="text" style="font-size:12px;border:1px inset green;"> Atribute.....

  10. #10
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Samsoske
    I tried it, and you can use the good old

    <input type="text" style="font-size:12px;border:1px inset green;"> Atribute.....
    The font-size property shouldn't be given length values with the px or pt units, either. IE cannot resize these. Use percentages.

    Mike

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •