SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Hybrid View

  1. #1
    SitePoint Enthusiast dziner's Avatar
    Join Date
    Jun 2004
    Location
    Harrisburg
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    No Text Entry via Opera

    I have a few form elements that when viewed in Opera do not allow entry of data. But some do. Any reason why this is happening? The first input field doesn't allow any input in Opera, but the second input field does.

    HTML Code:
    <input id="_id163:txtinzip1" type="text" name="_id163:txtinzip1" class="inputFixed" maxlength="5" onkeypress="return numbersonly(this,event)" size="5" />
    <span id="_id163:txtoutHyphen3"> - </span>
    <input id="_id163:txtinzip2" type="text" name="_id163:txtinzip2" class="inputFixed" maxlength="4" onkeypress="return numbersonly(this,event)" size="4" />
    On a possible related note. We are using javascript for numeric entry. So it may be possible that this javascript is causing issues with Opera?

    HTML Code:
    // numbers
    else if ((("0123456789").indexOf(keychar) > -1))
       return true;
    else
       return false;
    }
    function lettersonly(e)
    {
    var key;
    var keychar;
    if (window.event)
    	key = window.event.keyCode;
    else if (e)
    	key = e.which;
    else
    	return true;
    keychar = String.fromCharCode(key);
    keychar = keychar.toLowerCase();

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know if that's the cause of the problem, but your ID and NAME values are invalid. According to the spec:
    ID and NAME tokens must begin with a letter (&#91;A-Za-z&#93 and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
    (Emphasis mine.)

    Thus you cannot start those identifiers with underscore characters.
    Birnam wood is come to Dunsinane

  3. #3
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    I was going to say the nearly same thing about the ID - if you were using HTML that is.

  4. #4
    SitePoint Enthusiast dziner's Avatar
    Join Date
    Jun 2004
    Location
    Harrisburg
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is actually in a java page (.jsf). The page validates with monir errors and warnings, none of which are related to the underscore. Even so, why would the numeric entry work for the second input field but not the first one?

  5. #5
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The validator won't catch this sort of error, because it's based on the DTD, and DTDs cannot express these constraints.

    I'm not sure that this is the cause of your problem, but it's invalid at any rate and you should fix it. With invalid code, you have no right to expect browsers to do what you want. (They often don't even if you do have valid code, but that's another issue. )
    Birnam wood is come to Dunsinane

  6. #6
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    Off Topic:

    Mr T. Note that the collection of legal values in XML 1.0 Section 2.3, production 5 is much larger than that permitted to be used in the ID and NAME types defined in HTML 4.


    Maybe we need to see the rest of the Transitional code sample?

  7. #7
    SitePoint Enthusiast dziner's Avatar
    Join Date
    Jun 2004
    Location
    Harrisburg
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wish I understood how the html I create gets converted to jsf. My task is to create the html pages which then get converted by java programmers into jsf files. My html is always validated, but I can't speak for the jsf files.

    My thoughts are that it's something to do with the javascript. I believe it was included so that the user can only enter numeric characters. But I believe we have an implimentation for both IE and Mozilla. And maybe Opera handles this differently?

  8. #8
    Guru Meditation Error gnarly's Avatar
    Join Date
    Dec 2003
    Location
    Cheltenham, United Kingdom
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you tried removing the js to see if it's causing the issue?
    Olly Hodgson
    thinkdrastic.net

  9. #9
    SitePoint Enthusiast dziner's Avatar
    Join Date
    Jun 2004
    Location
    Harrisburg
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I haven't removed the js. Other form fields that also use the js work fine.


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
  •