html forms

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • yawnmoth

    html forms

    i've seen a few html forms, whose textarea's have text in them, and
    which reset when you click in that textarea... how can i do this?

    also, say my form has two different variables (namse, or whatever),
    but that these variables aren't supposed to be passed together. ie. i
    only want x=something or y=something, but not
    x=something&y=s omething... how would i do this, without creating a
    whole new form (which seems to, atleast in ie, create a new
    paragraph)?

    finally, my input tags are of type "image", and i guess because of
    this, they automatically pass two other variables - x and y, to tell
    the program that they're being passed two where exactly the user
    clicked. is there a way to disable this?
  • Jukka K. Korpela

    #2
    Re: html forms

    terra1024@yahoo .com (yawnmoth) wrote:
    [color=blue]
    > i've seen a few html forms, whose textarea's have text in them, and
    > which reset when you click in that textarea... how can i do this?[/color]

    You can put text there by making it the content of the textarea element. You
    cannot make it disappear (I guess that's what you mean by "reset") by using
    HTML. Besides, why would you do that?
    [color=blue]
    > also, say my form has two different variables (namse, or whatever),
    > but that these variables aren't supposed to be passed together.[/color]

    They are passed independently of each other, no matter what anyone supposes.
    You might be able to change this for some users by using tools external to
    HTML, but why would you do that?
    [color=blue]
    > ie. i
    > only want x=something or y=something, but not
    > x=something&y=s omething...[/color]

    I think you need to learn the basics of forms before you can benefit from
    answers here. See some links to tutorials at

    [color=blue]
    > how would i do this, without creating a
    > whole new form (which seems to, atleast in ie, create a new
    > paragraph)?[/color]

    Forms don't generate paragraphs. They may have default margins. But this is
    at a completely different level - presentational, not functional. You would
    need to post the URL and describe the real problem to get help that you can
    benefit from.
    [color=blue]
    > finally, my input tags are of type "image",[/color]

    They shouldn't. You have just identified one of your problems. And it seems
    that it's completely different from what you described above; you are now
    not complaining about two input elements each making a contribution to the
    form data set but about one special input element making a contribution of
    two name=value pairs _as defined in the specifications_ .
    [color=blue]
    > and i guess[/color]

    That's a second one. Stop making guesses, and read a tutorial, then use
    references.
    [color=blue]
    > because of
    > this, they automatically pass two other variables - x and y, to tell
    > the program that they're being passed two where exactly the user
    > clicked.[/color]

    Almost. But never mind the inaccuracies here. What you are basically
    complaining about is that browsers do what they are required to do.

    P.S. Please try and have your Shift key fixed.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

    Comment

    • Philipp Lenssen

      #3
      Re: html forms

      yawnmoth wrote:
      [color=blue]
      > i've seen a few html forms, whose textarea's have text in them, and
      > which reset when you click in that textarea... how can i do this?
      >
      > also, say my form has two different variables (namse, or whatever),
      > but
      > ....[/color]

      What do you actually want to achieve? You may be describing symptoms of
      a problem you wouldn't have if you'd understand the right approach.
      Besides, it can be highly annoying to have JavaScript e.g. reset text
      in a input-box or textarea.

      Comment

      • Stanimir Stamenkov

        #4
        Re: html forms

        yawnmoth wrote:
        [color=blue]
        > i've seen a few html forms, whose textarea's have text in them, and
        > which reset when you click in that textarea... how can i do this?[/color]

        You could use scripts where you initialize the content in a 'onload'
        function then in a 'onchange' (or whatever appropriate event)
        function to "reset" the content and probably set flag that this
        operation has happened so the next time the user presses a key (or
        whatever) the reset won't happen again. I should consult with a
        scripting group for actual implementation.
        [color=blue]
        > also, say my form has two different variables (namse, or whatever),
        > but that these variables aren't supposed to be passed together. ie. i
        > only want x=something or y=something, but not
        > x=something&y=s omething... how would i do this, without creating a
        > whole new form[/color]

        The correct way is to have a "whole new" form... there's no other
        way in fact, besides using scripting extensions, in the absence of
        which you get whole big zero functionality.
        [color=blue]
        > (which seems to, atleast in ie, create a new
        > paragraph)?[/color]

        It is not creating a new paragraph, it is that the FORM element is a
        block-level element [1] and the default rendering is to put margin
        before and after it (just like for the <P>aragraph element). You may
        change the default rendering using CSS [2] (where supported):

        form {
        margin-top : 0 ;
        margin-bottom : 0 ;
        }

        [1] http://www.w3.org/TR/html401/struct/...l#block-inline
        [2] http://www.w3.org/TR/CSS21/box.html#margin-properties
        [color=blue]
        > finally, my input tags are of type "image", and i guess because of
        > this, they automatically pass two other variables - x and y, to tell
        > the program that they're being passed two where exactly the user
        > clicked. is there a way to disable this?[/color]

        AFAIK, no. Consult with "Control types created with INPUT"
        <http://www.w3.org/TR/html401/interact/forms.html#inpu t-control-types>.

        --
        Stanimir

        Comment

        • yawnmoth

          #5
          Re: html forms

          Stanimir Stamenkov <s7an10@netscap e.net> wrote in message news:<bovq0m$1j 0euv$1@ID-207379.news.uni-berlin.de>...[color=blue]
          > yawnmoth wrote:
          >[color=green]
          > > (which seems to, atleast in ie, create a new
          > > paragraph)?[/color]
          >
          > It is not creating a new paragraph, it is that the FORM element is a
          > block-level element [1] and the default rendering is to put margin
          > before and after it (just like for the <P>aragraph element). You may
          > change the default rendering using CSS [2] (where supported):
          >
          > form {
          > margin-top : 0 ;
          > margin-bottom : 0 ;
          > }
          >
          > [1] http://www.w3.org/TR/html401/struct/...l#block-inline
          > [2] http://www.w3.org/TR/CSS21/box.html#margin-properties[/color]

          doing that does result in it not doing anything equiv. to <p>, but it
          still results in a new line, as one gets when one does a <br>... is
          there a way i can have the different forms be on the same line, as
          opposed to starting a new line (albeit one that is closer than it was
          before)?

          also, thanks for your other suggestions! :)

          Comment

          • yawnmoth

            #6
            Re: html forms

            "Philipp Lenssen" <info@outer-court.com> wrote in message news:<bovgfg$1h q4nr$3@ID-203055.news.uni-berlin.de>...[color=blue]
            > yawnmoth wrote:
            >[color=green]
            > > i've seen a few html forms, whose textarea's have text in them, and
            > > which reset when you click in that textarea... how can i do this?
            > >
            > > also, say my form has two different variables (namse, or whatever),
            > > but
            > > ....[/color]
            >
            > What do you actually want to achieve? You may be describing symptoms of
            > a problem you wouldn't have if you'd understand the right approach.
            > Besides, it can be highly annoying to have JavaScript e.g. reset text
            > in a input-box or textarea.[/color]

            the effect i'm trying to achieve is pretty much this...

            say i have some default text in a textarea on a form. this text could
            be informing the user that he needs to type something in, or
            something. i could just leave it up to the user to highlight the text
            and delete it, themselves, when they're ready to type something in,
            but i think it'd be neater if i could make it such that when the user
            simply clicked in the textarea, the text in there went away, and as
            such, nothing had to be highlighted / deleted. i've seen forms,
            elsewhere, do this, although i don't have any links, off hand.

            anyways, in looking at some of the other posts, it seems i'll have to
            augment my page with javascript, which i guess i'll look into some
            time later today, or something...

            Comment

            • yawnmoth

              #7
              Re: html forms

              "Jukka K. Korpela" <jkorpela@cs.tu t.fi> wrote in message news:<Xns943253 369865Djkorpela cstutfi@193.229 .0.31>...[color=blue]
              > terra1024@yahoo .com (yawnmoth) wrote:
              >[color=green]
              > > i've seen a few html forms, whose textarea's have text in them, and
              > > which reset when you click in that textarea... how can i do this?[/color]
              >
              > You can put text there by making it the content of the textarea element. You
              > cannot make it disappear (I guess that's what you mean by "reset") by using
              > HTML. Besides, why would you do that?[/color]

              I guess I'll be using javascript, then. As for why I would want to do
              it... I think it'd be a nice (although admittedly frivilious)
              addition to a homepage.
              [color=blue][color=green]
              > > also, say my form has two different variables (namse, or whatever),
              > > but that these variables aren't supposed to be passed together.[/color]
              >
              > They are passed independently of each other, no matter what anyone supposes.
              > You might be able to change this for some users by using tools external to
              > HTML, but why would you do that?[/color]

              I think you misunderstood my question, but Stanimir Stamenkov's answer
              seems to capture the essence of it quite nicely. As for why I would
              want to do it... I think it would be another nice, yet frivilious
              addition to a homepage. Something about extranious variables being
              passed just bugs me.

              Additionally, as I'm using GET, I would rather not have the resultant
              URL's be unnecessarily long. Now, correct me if I'm wrong, but as I
              understand it, the GET method simply appends data that is being passed
              to the server side script to the GET portion of the HTTP packet that
              the browser sends to the server. Consequently, the resultant URL has
              the data embedded within the URL, itself. If you copy the URL, you
              copy the data, without having to reenter it (as opposed to what you
              have to do with POST). This is what I want. Further, unnecessarily
              long URL's tend to cause wrap around problems on browsers, take more
              time to copy, and are, all in all, more of a hassle to deal with.
              [color=blue]
              > I think you need to learn the basics of forms before you can benefit from
              > answers here. See some links to tutorials at
              > http://www.cs.tut.fi/~jkorpela/forms/[/color]

              I compliment you for having a nice website. Your page comparing the
              GET and POST methods, for example, is very nice. Indeed, I referenced
              it when making my above rationale.
              [color=blue]
              > Forms don't generate paragraphs. They may have default margins. But this is
              > at a completely different level - presentational, not functional. You would
              > need to post the URL and describe the real problem to get help that you can
              > benefit from.[/color]

              I've managed to fix some of these issues, thanks to Stanimir
              Stamenkov's insights, but I have another problem, which I've described
              in my reply to Stanimir Stamenkov's post. The URL may well make it
              easier for others to offer assistance, but I would rather not, at this
              moment, post the URL, so I guess I'll have to make do with what advice
              I can get.
              [color=blue]
              >[color=green]
              > > finally, my input tags are of type "image",[/color]
              >
              > They shouldn't. You have just identified one of your problems. And it seems
              > that it's completely different from what you described above; you are now
              > not complaining about two input elements each making a contribution to the
              > form data set but about one special input element making a contribution of
              > two name=value pairs _as defined in the specifications_ .[/color]

              Again, I think you misunderstood my question, so I'm sorry for not
              making it clearer, although I do thank you for the effort you put
              forth to reply.
              [color=blue]
              > P.S. Please try and have your Shift key fixed.[/color]

              Okay.

              Comment

              • Stanimir Stamenkov

                #8
                Re: html forms

                yawnmoth wrote:
                [color=blue]
                > is
                > there a way i can have the different forms be on the same line, as
                > opposed to starting a new line (albeit one that is closer than it was
                > before)?[/color]

                Yes, you could override the default block or inline display of
                elements using CSS (consult with the c.i.w.a.stylesh eets group), but
                then what is the case where you want to put 2 (or more) forms in a
                single line? Do you actually need forms functionality or you use
                forms and form buttons to have link functionality?

                <form action="..." class="inline">
                <div class="inline">
                <input type="text" name="search">
                <input type="submit" value="Search">
                </div>
                </form>

                <form action="..." class="inline">
                <div class="inline">
                <input type="text" name="other">
                <input type="submit" value="Other">
                </div>
                </form>

                and declare the class "inline" in your stylesheet:

                ..inline { display: inline }

                Or you could make the two form blocks adjacent using floats:

                <form action="..." style="width: 50%; float: left">
                <div>
                <input type="text" name="search">
                <input type="submit" value="Search">
                </div>
                </form>

                <form action="...">
                <div>
                <input type="text" name="other">
                <input type="submit" value="Other">
                </div>
                </form>

                But you should really consult with the CSS spec and the
                "stylesheet s" group.

                --
                Stanimir

                Comment

                • yawnmoth

                  #9
                  Re: html forms

                  On Fri, 14 Nov 2003 13:58:34 +0200, Stanimir Stamenkov
                  <s7an10@netscap e.net> wrote:
                  [color=blue]
                  >yawnmoth wrote:
                  >[color=green]
                  >> is
                  >> there a way i can have the different forms be on the same line, as
                  >> opposed to starting a new line (albeit one that is closer than it was
                  >> before)?[/color]
                  >
                  >Yes, you could override the default block or inline display of
                  >elements using CSS (consult with the c.i.w.a.stylesh eets group), but
                  >then what is the case where you want to put 2 (or more) forms in a
                  >single line? Do you actually need forms functionality or you use
                  >forms and form buttons to have link functionality?[/color]

                  actually, heh, you're right! good catch! :)

                  Comment

                  Working...