control a form submit

Discussion in 'Javascript' started by cate, Jan 21, 2010.

  1. cate

    cate Guest

    I have something like this (trimmed down)

    <form id="aform",method="post">
    <input type="submit" id="butOne", value="butOne">
    <textarea id="tx1"></textarea>
    <input type="submit" id="butTwo" value="butTwo">
    <textarea id="tx2"></textarea>
    </form>

    I want to intercept the submit action on butOne, so I tried this

    <input type="button" id="butOne", value="butOne" onClick="checkStuff
    (this);">

    .... and added the js

    function checkStuff(e) {
    test test test
    document.getElementById('aform').submit();
    }

    Problem is that the two textarea don't seem to post. Go back to
    type=submit and everything seems fine.

    Thank you.
    cate, Jan 21, 2010
    #1
    1. Advertising

  2. cate wrote:

    > I have something like this (trimmed down)
    >
    > <form id="aform",method="post">
    > <input type="submit" id="butOne", value="butOne">
    > <textarea id="tx1"></textarea>
    > <input type="submit" id="butTwo" value="butTwo">
    > <textarea id="tx2"></textarea>
    > </form>


    Ahh -- yes. Pray learn HTML first.

    <http://validator.w3.org/>


    PointedEars
    --
    Anyone who slaps a 'this page is best viewed with Browser X' label on
    a Web page appears to be yearning for the bad old days, before the Web,
    when you had very little chance of reading a document written on another
    computer, another word processor, or another network. -- Tim Berners-Lee
    Thomas 'PointedEars' Lahn, Jan 21, 2010
    #2
    1. Advertising

  3. cate meinte:
    > I have something like this (trimmed down)
    >
    > <form id="aform",method="post">
    > <input type="submit" id="butOne", value="butOne">
    > <textarea id="tx1"></textarea>
    > <input type="submit" id="butTwo" value="butTwo">
    > <textarea id="tx2"></textarea>
    > </form>


    Creative markup.

    > Problem is that the two textarea don't seem to post. Go back to
    > type=submit and everything seems fine.


    Whatever that means...

    > Thank you.


    You are welcome.

    Gregor


    --
    http://www.gregorkofler.com
    Gregor Kofler, Jan 21, 2010
    #3
  4. cate

    Scott Sauyet Guest

    On Jan 21, 3:28 pm, cate <> wrote:
    > I have something like this (trimmed down)
    >
    > <form id="aform",method="post">
    >  <input type="submit" id="butOne", value="butOne">
    >  <textarea id="tx1"></textarea>
    >  <input type="submit" id="butTwo" value="butTwo">
    >  <textarea id="tx2"></textarea>
    > </form>


    One thing people want you to notice about the HTML is that you haven't
    closed your input tags

    > I want to intercept the submit action on butOne, so I tried this
    >
    >  <input type="button" id="butOne", value="butOne" onClick="checkStuff
    > (this);">


    Usually you will want to end the inline handler with "return false;"
    If not, your code will run and then the form will be submitted, even
    if you would rather it didn't. And the attribute name is
    "onclick" (all lower-case);

    onclick="checkStuff(this); return false;"

    One problem with "type='button'" is that this will not do anything for
    users without Javascript or for those with Javascript disabled. You
    can do the same thing with "type='submit'" without those problems.

    > ... and added the js
    >
    > function checkStuff(e) {
    >   test test test
    >   document.getElementById('aform').submit();
    >
    > }


    You might also want to consider removing the inline handler, and
    running something after the document is loaded to connect a click
    handler to the button or a submit handler to the form.

    window.onload = function() {
    var aForm = document.getElementById("aform");
    if (aForm) {
    aForm.onsubmit = function() {
    var result = runMyTests();
    return result;
    }
    }
    }

    Good luck,

    -- Scott
    Scott Sauyet, Jan 21, 2010
    #4
  5. Scott Sauyet wrote:

    > cate wrote:
    >> I have something like this (trimmed down)
    >>
    >> <form id="aform",method="post">
    >> <input type="submit" id="butOne", value="butOne">
    >> <textarea id="tx1"></textarea>
    >> <input type="submit" id="butTwo" value="butTwo">
    >> <textarea id="tx2"></textarea>
    >> </form>

    >
    > One thing people want you to notice about the HTML is that you haven't
    > closed your input tags


    Nobody knowing what they are talking about would say such an incredibly
    stupid thing. The "input tags" are closed (there's the TAGC delimiter,
    `>'). The INPUT elements, if this is HTML, are fine except for the comma;
    in fact, since their content model is EMPTY, the </input> _end_ tag is
    *forbidden*.

    >> I want to intercept the submit action on butOne, so I tried this
    >>
    >> <input type="button" id="butOne", value="butOne" onClick="checkStuff
    >> (this);">

    >
    > Usually you will want to end the inline handler with "return false;"


    No, usually you would want to cancel the `submit' event of the form
    instead. If, and only if, the control would cause form submission by
    default, which this one does NOT.

    > You might also want to consider removing the inline handler, and
    > running something after the document is loaded to connect a click
    > handler to the button or a submit handler to the form.
    >
    > window.onload = function() {


    You're really the worst kind of wannabe. Please have the kindness
    and be quiet until you got your facts right. Thank you in advance.

    OP: Don't listen to Scott.


    PointedEars
    --
    Use any version of Microsoft Frontpage to create your site.
    (This won't prevent people from viewing your source, but no one
    will want to steal it.)
    -- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
    Thomas 'PointedEars' Lahn, Jan 21, 2010
    #5
  6. Scott Sauyet meinte:
    > On Jan 21, 3:28 pm, cate <> wrote:
    >> I have something like this (trimmed down)
    >>
    >> <form id="aform",method="post">
    >> <input type="submit" id="butOne", value="butOne">
    >> <textarea id="tx1"></textarea>
    >> <input type="submit" id="butTwo" value="butTwo">
    >> <textarea id="tx2"></textarea>
    >> </form>

    >
    > One thing people want you to notice about the HTML is that you haven't
    > closed your input tags


    They won't.

    >> I want to intercept the submit action on butOne, so I tried this
    >>
    >> <input type="button" id="butOne", value="butOne" onClick="checkStuff
    >> (this);">

    >
    > Usually you will want to end the inline handler with "return false;"
    > If not, your code will run and then the form will be submitted, even
    > if you would rather it didn't. And the attribute name is
    > "onclick" (all lower-case);
    >
    > onclick="checkStuff(this); return false;"


    Which won't cancel a submit with button-type input elements.

    > One problem with "type='button'" is that this will not do anything for
    > users without Javascript or for those with Javascript disabled. You
    > can do the same thing with "type='submit'" without those problems.
    >
    >> ... and added the js
    >>
    >> function checkStuff(e) {
    >> test test test
    >> document.getElementById('aform').submit();
    >>
    >> }

    >
    > You might also want to consider removing the inline handler, and
    > running something after the document is loaded to connect a click
    > handler to the button or a submit handler to the form.
    >
    > window.onload = function() {
    > var aForm = document.getElementById("aform");
    > if (aForm) {
    > aForm.onsubmit = function() {
    > var result = runMyTests();
    > return result;
    > }
    > }
    > }


    There's only a body.onload... Besides I can't see any advantage of this
    approach, at least not in this specific case.

    Gregor


    --
    http://www.gregorkofler.com
    Gregor Kofler, Jan 21, 2010
    #6
  7. Scott Sauyet <> wrote:

    >     window.onload = function() {
    >         var aForm = document.getElementById("aform");
    >         if (aForm) {
    >             aForm.onsubmit = function() {
    >                 var result = runMyTests();
    >                 return result;
    >             }
    >         }
    >     }


    You make a circular reference pattern.

    VO -> aForm -> onsubmit -> AFE[[scope]] -> VO

    JScript implementation before version 5.8 have trouble with garbage
    collection especially, when deal with host objects.

    <URL: http://www.jibbering.com/faq/faq_notes/closures.html#clMem />
    <URL: http://blogs.msdn.com/ericlippert/archive/2003/09/17/53038.aspx /
    >



    You should break circular reference:

    aForm.onsubmit = function(){
    };
    aForm = null;

    Regards.
    Asen Bozhilov, Jan 21, 2010
    #7
  8. cate

    Scott Sauyet Guest

    On Jan 21, 4:49 pm, Thomas 'PointedEars' Lahn <>
    wrote:
    >>     window.onload = function() {

    >
    > You're really the worst kind of wannabe.  Please have the kindness
    > and be quiet until you got your facts right.  Thank you in advance.
    >
    > OP: Don't listen to Scott.


    OP: Instead, listen to all the useful advice Thomas has given so far.
    Oh wait, all he has offered is non-specific criticism of your markup,
    and a partially-valid critique of my suggestions.

    -- Scott
    Scott Sauyet, Jan 22, 2010
    #8
  9. cate

    Scott Sauyet Guest

    On Jan 21, 5:14 pm, Asen Bozhilov <> wrote:
    > Scott Sauyet <> wrote:
    >
    > You make a circular reference pattern.
    >
    > VO -> aForm -> onsubmit -> AFE[[scope]] -> VO
    > [ ... ]
    > You should break circular reference:
    >
    > aForm.onsubmit = function(){};
    > aForm = null;


    Absolutely correct. Thank you for pointing it out.

    -- Scott
    Scott Sauyet, Jan 22, 2010
    #9
  10. On Jan 22, 4:29 pm, Scott Sauyet wrote:
    > On Jan 21, 4:49 pm, Thomas 'PointedEars' Lahn wrote:
    >
    >>> window.onload = function() {

    >
    >> You're really the worst kind of wannabe. Please have the
    >> kindness and be quiet until you got your facts right.
    >> Thank you in advance.

    >
    >> OP: Don't listen to Scott.

    >
    > OP: Instead, listen to all the useful advice Thomas has given
    > so far. Oh wait, all he has offered is non-specific criticism
    > of your markup, and a partially-valid critique of my suggestions.


    Assuming the above is not part of a "partially-valid critique" of your
    suggestions (as it seems to be a general comment rather than being
    about any suggestions made), which part of his "critique" was not
    valid?

    Your comments in relation to the mark-up were absolutely wrong (both
    in terms of what 'people' were trying to draw attention towards and
    the technical aspects of your suggested changes), and Thomas' comments
    on it were spot-on. His comments on the "return false;" suggestions
    may have started out with a slightly subjective assertion (if one that
    I agree with), but the observation that <input type="button"> elements
    don't have a default action to be cancelled by such code was making a
    valid point.

    I do not agree with the section you quoted above. VK is easily "the
    worst kind of wannabe" (combining, as he does, a self-created fantasy
    understanding of javascript, an inability to understand when he is
    shown to be wrong and an approach to reasoning that rarely achieves
    lucidity) (sorry, I could not think of a way of expressing that which
    does imply that you are also a "wannabe", which is not sort of
    terminology that I would normally use, and strikes me as a very
    premature conclusion). And being quiet until you get your facts right
    would be a very bad idea, and generally unwelcome. As a learning
    exercise, it is best to say what you think about the subject and then
    listen to the criticism that receives. And it is in the discussions
    that follow from those exchanges that much of the interesting content
    on the group can be found.

    Richard.
    Richard Cornford, Jan 22, 2010
    #10
  11. cate

    Scott Sauyet Guest

    On Jan 22, 12:19 pm, Richard Cornford <>
    wrote:
    > On Jan 22, 4:29 pm, Scott Sauyet wrote:
    >
    > > On Jan 21, 4:49 pm, Thomas 'PointedEars' Lahn wrote:

    >
    > >>>     window.onload = function() {

    >
    > >> You're really the worst kind of wannabe.  Please have the
    > >> kindness and be quiet until you got your facts right.
    > >> Thank you in advance.

    >
    > >> OP: Don't listen to Scott.

    >
    > > OP: Instead, listen to all the useful advice Thomas has given
    > > so far. Oh wait, all he has offered is non-specific criticism
    > > of your markup, and a partially-valid critique of my suggestions.

    >
    > Assuming the above is not part of a "partially-valid critique" of your
    > suggestions (as it seems to be a general comment rather than being
    > about any suggestions made), which part of his "critique" was not
    > valid?
    >
    > Your comments in relation to the mark-up were absolutely wrong (both
    > in terms of what 'people' were trying to draw attention towards and
    > the technical aspects of your suggested changes), and Thomas' comments
    > on it were spot-on. His comments on the "return false;" suggestions
    > may have started out with a slightly subjective assertion (if one that
    > I agree with), but the observation that <input type="button"> elements
    > don't have a default action to be cancelled by such code was making a
    > valid point.


    Well, his comments on the mark-up are only valid for HTML doctypes.
    Whereas this is valid for HTML4 or XHTML:

    <input type="submit" id="butOne" value="butOne"/>

    But a major point is that when the OP prefaced the markup with this:

    | I have something like this (trimmed down)

    criticizing the markup for its failure to include rows/cols attributes
    on the textareas or block elements around the form controls or for
    some spurious commas in what's typed in to this post seems to be pure
    pettiness. It's certainly not aimed at actually helping the OP solve
    the problem at hand, as far as I can tell. I guess I should have
    realized that it was just that sort of pettiness at play, but I'm not
    sure it was a valid critique to assume that Thomas knew the OP's
    DOCTYPE, and hence I was wrong. Obviously I did get wrong what others
    were criticizing in the markup, though.

    Thomas' critique of my suggestion about "return false" were not only
    subjective; they also ignored the succeeding paragraph where I
    explicitly suggested that the OP not change to type="button", but
    stick with type="submit", for which the default action *is* the form
    submit we want to cancel.


    > I do not agree with the section you quoted above. VK is easily "the
    > worst kind of wannabe" (combining, as he does, a self-created fantasy
    > understanding of javascript, an inability to understand when he is
    > shown to be wrong and an approach to reasoning that rarely achieves
    > lucidity) (sorry, I could not think of a way of expressing that which
    > does imply that you are also a "wannabe", which is not sort of
    > terminology that I would normally use, and strikes me as a very
    > premature conclusion).


    Actually, I have pretty thick skin. Maybe I am a wannabe. :)


    > And being quiet until you get your facts right
    > would be a very bad idea, and generally unwelcome. As a learning
    > exercise, it is best to say what you think about the subject and then
    > listen to the criticism that receives.


    Agreed. I'm sure I won't be a member of this forum for years on end,
    but while I am here, I plant to learn what I can, and to share what
    I've learned. That doesn't involve being quiet, even if I know I'm
    likely to be wrong fairly often.


    > And it is in the discussions
    > that follow from those exchanges that much of the interesting content
    > on the group can be found.


    Yes, that's true. But I also would prefer that the environs were at
    least hospitable to less advanced JS users here earnestly asking for
    advice. That was the only reason that I bothered to respond to
    Thomas.

    I would not have posted my first message on this thread had someone
    given the OP a competent answer, preferring to learn from the most
    experienced people here. But all that had been posted were small-
    minded critiques of the markup. After my response, Asen gave a useful
    critique of my post offering an improvement to my suggestion for the
    OP, Gregor gave a less useful response that argued against my
    suggestions but gave no suggestions for the OP, and Thomas gave one
    that criticized my solution, insulted me, and still offered no help to
    the OP.

    I believe I am not overly sensitive. Had Thomas actually offered
    competent help to the OP, I would not have responded to his insults.
    But since the only response was, in essence, "Your markup sucks; go
    away," I didn't feel Thomas had earned the right to insult my efforts
    unchallenged.

    I'm curious as to whether someone in this group, had the OP used the
    following markup (which I think would be valid in HTML or XHTML),
    would have posted a more useful response:

    <form id="aform" method="post" action="myAction">
    <p>
    <input type="submit" id="butOne" value="butOne"/>
    <textarea id="tx1" rows="3" cols="20"></textarea>
    <input type="submit" id="butTwo" value="butTwo"/>
    <textarea id="tx2" rows="3" cols="20"></textarea>
    </p>
    </form>

    Would that have made a difference? Is this newsgroup really that
    petty?

    -- Scott
    Scott Sauyet, Jan 22, 2010
    #11
  12. cate

    David Mark Guest

    Scott Sauyet wrote:
    > On Jan 22, 12:19 pm, Richard Cornford <>
    > wrote:
    >> On Jan 22, 4:29 pm, Scott Sauyet wrote:
    >>
    >>> On Jan 21, 4:49 pm, Thomas 'PointedEars' Lahn wrote:
    >>>>> window.onload = function() {
    >>>> You're really the worst kind of wannabe. Please have the
    >>>> kindness and be quiet until you got your facts right.
    >>>> Thank you in advance.
    >>>> OP: Don't listen to Scott.
    >>> OP: Instead, listen to all the useful advice Thomas has given
    >>> so far. Oh wait, all he has offered is non-specific criticism
    >>> of your markup, and a partially-valid critique of my suggestions.

    >> Assuming the above is not part of a "partially-valid critique" of your
    >> suggestions (as it seems to be a general comment rather than being
    >> about any suggestions made), which part of his "critique" was not
    >> valid?
    >>
    >> Your comments in relation to the mark-up were absolutely wrong (both
    >> in terms of what 'people' were trying to draw attention towards and
    >> the technical aspects of your suggested changes), and Thomas' comments
    >> on it were spot-on. His comments on the "return false;" suggestions
    >> may have started out with a slightly subjective assertion (if one that
    >> I agree with), but the observation that <input type="button"> elements
    >> don't have a default action to be cancelled by such code was making a
    >> valid point.

    >
    > Well, his comments on the mark-up are only valid for HTML doctypes.
    > Whereas this is valid for HTML4 or XHTML:
    >
    > <input type="submit" id="butOne" value="butOne"/>


    Not a chance. Lose the slash.

    >
    > But a major point is that when the OP prefaced the markup with this:
    >
    > | I have something like this (trimmed down)
    >
    > criticizing the markup for its failure to include rows/cols attributes
    > on the textareas or block elements around the form controls or for
    > some spurious commas in what's typed in to this post seems to be pure
    > pettiness.


    How is that your concern? Is there something about extra (and correct)
    information that grinds your gears? You write too much about other
    people and what they are doing. Try to stick to ideas.

    > It's certainly not aimed at actually helping the OP solve
    > the problem at hand, as far as I can tell.


    Again, you are not the group constable. Nobody wants to hear you go on
    and on (and on and on) about other people's posts. If you have
    something to add, add it. Otherwise, leave it alone (or use email to
    communicate your suggestions).

    > I guess I should have
    > realized that it was just that sort of pettiness at play, but I'm not
    > sure it was a valid critique to assume that Thomas knew the OP's
    > DOCTYPE, and hence I was wrong. Obviously I did get wrong what others
    > were criticizing in the markup, though.


    Well, no shock there as you are clearly a beginner. Best to listen more
    than you speak at this point on the learning curve. ;)

    >
    > Thomas' critique of my suggestion about "return false" were not only
    > subjective; they also ignored the succeeding paragraph where I
    > explicitly suggested that the OP not change to type="button", but
    > stick with type="submit", for which the default action *is* the form
    > submit we want to cancel.


    That must have been one of those wrong things mentioned. No you don't
    change to a submit button (unless you are submitting a form). And don't
    switch to a button element either (in case that one came up too).

    >
    >
    >> I do not agree with the section you quoted above. VK is easily "the
    >> worst kind of wannabe" (combining, as he does, a self-created fantasy
    >> understanding of javascript, an inability to understand when he is
    >> shown to be wrong and an approach to reasoning that rarely achieves
    >> lucidity) (sorry, I could not think of a way of expressing that which
    >> does imply that you are also a "wannabe", which is not sort of
    >> terminology that I would normally use, and strikes me as a very
    >> premature conclusion).

    >
    > Actually, I have pretty thick skin. Maybe I am a wannabe. :)


    I don't see the connection. Did you mean wallaby? :)

    >
    >
    >> And being quiet until you get your facts right
    >> would be a very bad idea, and generally unwelcome. As a learning
    >> exercise, it is best to say what you think about the subject and then
    >> listen to the criticism that receives.

    >
    > Agreed. I'm sure I won't be a member of this forum for years on end,
    > but while I am here, I plant to learn what I can, and to share what
    > I've learned. That doesn't involve being quiet, even if I know I'm
    > likely to be wrong fairly often.
    >
    >
    >> And it is in the discussions
    >> that follow from those exchanges that much of the interesting content
    >> on the group can be found.

    >
    > Yes, that's true. But I also would prefer that the environs were at
    > least hospitable to less advanced JS users here earnestly asking for
    > advice. That was the only reason that I bothered to respond to
    > Thomas.


    That's always the tired refrain of the would-be group cops. In time you
    will understand that this is not a help desk, nor could it ever be a
    help desk. Help desks cost money for a reason.

    >
    > I would not have posted my first message on this thread had someone
    > given the OP a competent answer, preferring to learn from the most
    > experienced people here. But all that had been posted were small-
    > minded critiques of the markup.


    You never stop. Critics of critics are the worst sort of noise in a
    group like this. If you don't like PE's asides, ignore them.

    > After my response, Asen gave a useful
    > critique of my post offering an improvement to my suggestion for the
    > OP, Gregor gave a less useful response that argued against my
    > suggestions but gave no suggestions for the OP, and Thomas gave one
    > that criticized my solution, insulted me, and still offered no help to
    > the OP.


    How are you judging all of this? You are a rookie yourself. And if
    there are too words I hate here, they are "no help". Tell somebody who
    is combining Flash/jQuery/MooTools/YUI/Prototype on one page to stop
    doing it as you aren't about to wade through all of that crap and they
    start shrieking "no help!", hoping to appeal to group pathos. Yes, they
    usually claim to have been insulted too. If it's a moderated group,
    calls for bans usually follow. One schnook begets two, two beget four,
    etc. Discussion groups are idiot multipliers (or there are a lot of
    really smart people just pretending to be morons online).

    >
    > I believe I am not overly sensitive. Had Thomas actually offered
    > competent help to the OP, I would not have responded to his insults.


    Again, it's not really for you to judge. Relatively speaking, you are
    nobody. :(

    > But since the only response was, in essence, "Your markup sucks; go
    > away," I didn't feel Thomas had earned the right to insult my efforts
    > unchallenged.


    But that wasn't it, was it?

    >
    > I'm curious as to whether someone in this group, had the OP used the
    > following markup (which I think would be valid in HTML or XHTML),
    > would have posted a more useful response:
    >
    > <form id="aform" method="post" action="myAction">
    > <p>
    > <input type="submit" id="butOne" value="butOne"/>
    > <textarea id="tx1" rows="3" cols="20"></textarea>
    > <input type="submit" id="butTwo" value="butTwo"/>
    > <textarea id="tx2" rows="3" cols="20"></textarea>
    > </p>
    > </form>
    >
    > Would that have made a difference? Is this newsgroup really that
    > petty?
    >


    I have no idea what you are talking about. The above is not valid HTML
    and XHTML is dead (at least on the Web). So what's with the funny
    slashes? :)
    David Mark, Jan 22, 2010
    #12
  13. cate

    Scott Sauyet Guest

    On Jan 22, 1:56 pm, David Mark <> wrote:
    > Scott Sauyet wrote:
    >> I'm curious as to whether someone in this group, had the OP used the
    >> following markup (which I think would be valid in HTML or XHTML),
    >> would have posted a more useful response:

    >
    >>     <form id="aform" method="post" action="myAction">
    >>       <p>
    >>         <input type="submit" id="butOne" value="butOne"/>
    >>         <textarea id="tx1" rows="3" cols="20"></textarea>
    >>         <input type="submit" id="butTwo" value="butTwo"/>
    >>         <textarea id="tx2" rows="3" cols="20"></textarea>
    >>       </p>
    >>     </form>

    >
    >> Would that have made a difference?  Is this newsgroup really that
    >> petty?

    >
    > I have no idea what you are talking about.  The above is not valid HTML


    The W3C does not agree with you:

    http://validator.w3.org/check?uri=http://scott.sauyet.com/Javascript/Demo/2010-01-22d/
    http://validator.w3.org/check?uri=http://scott.sauyet.com/Javascript/Demo/2010-01-22c/

    -- Scott
    Scott Sauyet, Jan 23, 2010
    #13
  14. Richard Cornford wrote:

    > I do not agree with the section you quoted above. VK is easily "the
    > worst kind of wannabe" (combining, as he does, a self-created fantasy
    > understanding of javascript, an inability to understand when he is
    > shown to be wrong and an approach to reasoning that rarely achieves
    > lucidity) (sorry, I could not think of a way of expressing that which
    > does imply that you are also a "wannabe", which is not sort of
    > terminology that I would normally use, and strikes me as a very
    > premature conclusion). And being quiet until you get your facts right
    > would be a very bad idea, and generally unwelcome. As a learning
    > exercise, it is best to say what you think about the subject and then
    > listen to the criticism that receives. And it is in the discussions
    > that follow from those exchanges that much of the interesting content
    > on the group can be found.


    ACK. Sloppy wording on my part. What I meant to say is this: I think it
    is better for one to refrain from trying to help a newbie if oneself does
    not yet have a clue what one is talking about (despite having had the
    opportunity to read a considerable amount of clarifying postings before;
    that's how I define a wannabe).

    The confusion that must follow in the newbie by the contradicting and
    naturally often much more "technical" corrections then (or later, when they
    find out that what was suggested is not as it works), and the unlearning
    required, is much more harmful than no answer at all (should nobody
    knowledgable decide to reply), or the correct answer(s) only.

    Cf. "If you don't know for sure, say so!", and "If you're going to answer
    the question at all, give good value." in
    <http://catb.org/~esr/faqs/smart-questions.html#id383614>.


    PointedEars
    --
    var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
    ) // Plone, register_function.js:16
    Thomas 'PointedEars' Lahn, Jan 23, 2010
    #14
  15. cate

    David Mark Guest

    On Jan 22, 9:32 pm, Scott Sauyet <> wrote:
    > On Jan 22, 1:56 pm, David Mark <> wrote:
    >
    >
    >
    > > Scott Sauyet wrote:
    > >> I'm curious as to whether someone in this group, had the OP used the
    > >> following markup (which I think would be valid in HTML or XHTML),
    > >> would have posted a more useful response:

    >
    > >> <form id="aform" method="post" action="myAction">
    > >> <p>
    > >> <input type="submit" id="butOne" value="butOne"/>
    > >> <textarea id="tx1" rows="3" cols="20"></textarea>
    > >> <input type="submit" id="butTwo" value="butTwo"/>
    > >> <textarea id="tx2" rows="3" cols="20"></textarea>
    > >> </p>
    > >> </form>

    >
    > >> Would that have made a difference? Is this newsgroup really that
    > >> petty?

    >
    > > I have no idea what you are talking about. The above is not valid HTML

    >
    > The W3C does not agree with you:
    >


    > http://validator.w3.org/check?uri=http://scott.sauyet.com/Javascript/...
    > http://validator.w3.org/check?uri=http://scott.sauyet.com/Javascript/...


    Will you please stop demonstrating your ignorance. Those slashes are
    errors and will have to be error-corrected by the browser. The fact
    that the online validation tool now calls them "warnings" instead of
    errors is irrelevant. It's just a piece of software (and not a
    particularly good one either). So don't get caught up in the
    semantics of its messages. ;)
    David Mark, Jan 23, 2010
    #15
  16. Richard Cornford wrote:

    > Scott Sauyet wrote:
    >> Well, his comments on the mark-up are only valid for HTML doctypes.
    >> Whereas this is valid for HTML4 or XHTML:
    >>
    >> <input type="submit" id="butOne" value="butOne"/>

    >
    > That is a true statement (at least to the extent to which it is possible
    > to declare any mark-up fragment 'valid', given that validity is a
    > quality that only applies to hole documents in this context), but it is
    > a true statement behind which there is an explanation that reveals a
    > very messy truth.
    >
    > HTML is an application of SGML (Standard Generalised Markup Language, as
    > defined in ISO 8879). HTML 4 has an "SGML Declaration" which asserts a
    > set of features from SGML that are (theoretically) used in HTML, and
    > which impact on HTML validity. An extract from that document reads:-
    >
    > | <!SGML "ISO 8879:1986 (WWW)"
    > | --
    > | SGML Declaration for HyperText Markup Language version HTML 4
    > | ...
    > | --
    > | ...
    > | FEATURES
    > | MINIMIZE
    > | DATATAG NO
    > | OMITTAG YES
    > | RANK NO
    > | SHORTTAG YES
    > |
    > | ...
    >
    > So, for example, that "OMITTAG YES" allows HTML to imply opening and
    > closing tags based on (structural) context, in a way that is forbidden
    > in XML (and so in XHTML). The "SHORTTAG YES" makes provision for an SGML
    > shorthand that allows, e.g.:-
    >
    > <title></title>
    >
    > - to be written as:-
    >
    > <title/
    >
    > -(note that there is no closing chevron in that TITLE element
    > declaration).


    No SGML markup item (to avoid the ambiguous term "element") is a
    declaration if it does not start with `<!' (Markup Declaration Open [MDO]
    delimiter).

    The correct term for this is _start tag_ (of an element).


    PointedEars
    --
    realism: HTML 4.01 Strict
    evangelism: XHTML 1.0 Strict
    madness: XHTML 1.1 as application/xhtml+xml
    -- Bjoern Hoehrmann
    Thomas 'PointedEars' Lahn, Jan 23, 2010
    #16
  17. Valid markup (was: control a form submit)

    David Mark wrote:

    > Scott Sauyet wrote:
    >> David Mark wrote:
    >> > Scott Sauyet wrote:
    >> >> I'm curious as to whether someone in this group, had the OP used the
    >> >> following markup (which I think would be valid in HTML or XHTML),
    >> >> would have posted a more useful response:
    >> >> <form id="aform" method="post" action="myAction">
    >> >> <p>
    >> >> <input type="submit" id="butOne" value="butOne"/>
    >> >> <textarea id="tx1" rows="3" cols="20"></textarea>
    >> >> <input type="submit" id="butTwo" value="butTwo"/>
    >> >> <textarea id="tx2" rows="3" cols="20"></textarea>
    >> >> </p>
    >> >> </form>
    >> >>
    >> >> Would that have made a difference? Is this newsgroup really that
    >> >> petty?
    >> >
    >> > I have no idea what you are talking about. The above is not valid
    >> > HTML

    >>
    >> The W3C does not agree with you:
    >>
    >>

    http://validator.w3.org/check?uri=http://scott.sauyet.com/Javascript/...
    >>

    http://validator.w3.org/check?uri=http://scott.sauyet.com/Javascript/...
    >
    > Will you please stop demonstrating your ignorance.


    ACK.

    > Those slashes are errors


    Not necessarily.

    > and will have to be error-corrected by the browser.


    Yes, most likely, since so far only three implementations have been shown
    to implement some features of HTML SHORTTAG:

    [de] <http://www.dodabo.de/html+css/tests/shorttag.html>

    > The fact that the online validation tool now calls them "warnings"
    > instead of errors is irrelevant.


    No, warnings point out that the marked part is actually Valid markup,
    however one unwise to use (as in SHOULD NOT). If there is a real error (as
    in MUST NOT), it will be flagged as such, regardless whether it is caused
    by wrong application of SHORTTAG syntax (like Richard's example for the
    SHORTTAGged TITLE element, which, according to my understanding and tests,
    can never become Valid).

    > It's just a piece of software (and not a particularly good one either).


    How so? IBTD.

    IMNSHO, it is only that many people fail to understand that the W3C
    Validator is naturally only a *syntax* validator. As a result, Validation
    is in itself not a means to ensure software quality; whether source code
    makes sense or not, whether markup is properly used (semantics), and how
    compatible it is in a given context (pragmatics), cannot be determined (at
    the moment).

    However, (IMHO considerable) efforts have been made to improve the
    Validator over the years, including to make the Validator's messages more
    understable so as to mitigate the inherent disadvantage of a syntax-only
    validator, and those efforts should gain some recognition.

    > So don't get caught up in the semantics of its messages. ;)


    In my experience, one (especially newcomers) SHOULD always enable Verbose
    Output (checked checkbox, or `verbose=1' as component of the query part
    should one want to use tools like Web Developer Toolbar) and try to
    understand the explanations given with each warning or error message then.
    If still not understandable, maybe the FAQ (explicitly linked to in Verbose
    Mode) can provide insight. If not, that is likely to be a case for
    checking the TODO list and the bug list, and reporting a bug if no similar
    entry can be found in either (regardless whether the report turns out to
    show a real bug as in a misrecognition or as in not understandable output,
    or no bug at all).

    In addition, the W3C Validator is Open Source (under the Open Source
    Initiative's Open Source Definition) and free software (GPL-compatible), so
    besides reporting bugs there is the possibility for everyone to contribute
    in other ways as well or release one's own, perhaps better, fork of the
    Validator (follow the "Contribute" link for details).


    PointedEars
    --
    Anyone who slaps a 'this page is best viewed with Browser X' label on
    a Web page appears to be yearning for the bad old days, before the Web,
    when you had very little chance of reading a document written on another
    computer, another word processor, or another network. -- Tim Berners-Lee
    Thomas 'PointedEars' Lahn, Jan 23, 2010
    #17
  18. cate

    Eric Bednarz Guest

    Thomas 'PointedEars' Lahn <> writes:

    > Richard Cornford wrote:


    >> […] The "SHORTTAG YES" makes provision for an SGML
    >> shorthand that allows, e.g.:-
    >>
    >> <title></title>
    >>
    >> - to be written as:-
    >>
    >> <title/


    Not exactly. Rather as:

    <title//

    >> -(note that there is no closing chevron in that TITLE element
    >> declaration).

    >
    > No SGML markup item (to avoid the ambiguous term "element") is a
    > declaration if it does not start with `<!'


    That is a false – generalized – statement, because it implies the
    reference concrete syntax.

    > (Markup Declaration Open [MDO]
    > delimiter).


    > The correct term for this is _start tag_ (of an element).


    The correct term is ‘start-tag’.
    Eric Bednarz, Jan 23, 2010
    #18
  19. Eric Bednarz wrote:

    > Thomas 'PointedEars' Lahn <> writes:
    >> Richard Cornford wrote:
    >>> <title/

    > [...]
    >>> -(note that there is no closing chevron in that TITLE element
    >>> declaration).

    >>
    >> No SGML markup item (to avoid the ambiguous term "element") is a
    >> declaration if it does not start with `<!'

    >
    > That is a false – generalized – statement, because it implies the
    > reference concrete syntax.


    Maybe so; however, the code above is certainly no declaration.

    What other declarations are there in SGML that do not start with `<!'
    (MDO)?

    >> (Markup Declaration Open [MDO]
    >> delimiter).

    >
    >> The correct term for this is _start tag_ (of an element).

    >
    > The correct term is ‘start-tag’.


    I daresay that is a matter of preference; the hyphenization of compound
    words is not fixed in English. We can find occurrences of "start-tag", but
    also "start tag" in references; in the SGML grammar we can also find
    "start_tag" which would indicate that the original wording was "start tag"
    (as in "element_content" for "element content").


    PointedEars
    --
    realism: HTML 4.01 Strict
    evangelism: XHTML 1.0 Strict
    madness: XHTML 1.1 as application/xhtml+xml
    -- Bjoern Hoehrmann
    Thomas 'PointedEars' Lahn, Jan 24, 2010
    #19
  20. cate

    Eric Bednarz Guest

    Thomas 'PointedEars' Lahn <> writes:

    > Eric Bednarz wrote:
    >
    >> Thomas 'PointedEars' Lahn <> writes:


    >>> No SGML markup item (to avoid the ambiguous term "element") is a
    >>> declaration if it does not start with `<!'

    >>
    >> That is a false – generalized – statement, because it implies the
    >> reference concrete syntax.


    […]

    > What other declarations are there in SGML that do not start with `<!'
    > (MDO)?


    I don’t know what was difficult to understand about my statement.


    <!SGML "ISO 8879:1986 (WWW)"
    CHARSET
    BASESET
    "ISO 646:1983//CHARSET International
    Reference Version (IRV)//ESC 2/5 4/0"
    DESCSET
    0 9 UNUSED
    9 2 9
    11 2 UNUSED
    13 1 13
    14 18 UNUSED
    32 95 32
    127 1 UNUSED
    CAPACITY
    PUBLIC "ISO 8879-1986//CAPACITY Reference//EN"
    SCOPE
    DOCUMENT
    SYNTAX
    SHUNCHAR NONE
    BASESET
    "ISO 646-1983//CHARSET International
    Reference Version (IRV)//ESC 2/5 4/0"
    DESCSET
    0 128 0
    FUNCTION
    RE 13
    RS 10
    SPACE 32
    TAB SEPCHAR 9
    NAMING
    LCNMSTRT ""
    UCNMSTRT ""
    LCNMCHAR ""
    UCNMCHAR ""
    NAMECASE
    GENERAL YES
    ENTITY NO
    DELIM
    GENERAL SGMLREF
    DSC "."
    DSO ":"
    MDC "."
    MDO "AN"
    NESTC "('"
    NET "');"
    STAGO "j"
    SHORTREF SGMLREF
    NAMES
    SGMLREF
    ANY ANSWERED
    DOCTYPE SWER
    ELEMENT Y
    QUANTITY
    SGMLREF
    FEATURES
    MINIMIZE
    DATATAG NO
    OMITTAG NO
    RANK NO
    SHORTTAG YES
    LINK
    SIMPLE NO
    IMPLICIT NO
    EXPLICIT NO
    OTHER
    CONCUR NO
    SUBDOC NO
    FORMAL NO
    APPINFO NONE

    >

    Answer query:
    Any query answered...
    jQuery('SGML is bad, mkay');
    Eric Bednarz, Jan 24, 2010
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page