By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,478 Members | 1,833 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,478 IT Pros & Developers. It's quick & easy.

html forms

P: n/a
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=something... 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?
Jul 20 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
te*******@yahoo.com (yawnmoth) wrote:
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?
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?
also, say my form has two different variables (namse, or whatever),
but that these variables aren't supposed to be passed together.
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?
ie. i
only want x=something or y=something, but not
x=something&y=something...
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/
how would i do this, without creating a
whole new form (which seems to, atleast in ie, create a new
paragraph)?
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.
finally, my input tags are of type "image",
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_.
and i guess
That's a second one. Stop making guesses, and read a tutorial, then use
references.
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.


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

Jul 20 '05 #2

P: n/a
yawnmoth wrote:
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
....


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.
Jul 20 '05 #3

P: n/a
yawnmoth wrote:
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?
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.
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=something... how would i do this, without creating a
whole new form
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.
(which seems to, atleast in ie, create a new
paragraph)?
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
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?


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

--
Stanimir

Jul 20 '05 #4

P: n/a
Stanimir Stamenkov <s7****@netscape.net> wrote in message news:<bo*************@ID-207379.news.uni-berlin.de>...
yawnmoth wrote:
(which seems to, atleast in ie, create a new
paragraph)?


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


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! :)
Jul 20 '05 #5

P: n/a
"Philipp Lenssen" <in**@outer-court.com> wrote in message news:<bo*************@ID-203055.news.uni-berlin.de>...
yawnmoth wrote:
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
....


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.


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...
Jul 20 '05 #6

P: n/a
"Jukka K. Korpela" <jk******@cs.tut.fi> wrote in message news:<Xn*****************************@193.229.0.31 >...
te*******@yahoo.com (yawnmoth) wrote:
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?
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?


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.
also, say my form has two different variables (namse, or whatever),
but that these variables aren't supposed to be passed together.


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?


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.
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/
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.
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.
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.
finally, my input tags are of type "image",
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_.


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.
P.S. Please try and have your Shift key fixed.


Okay.
Jul 20 '05 #7

P: n/a
yawnmoth wrote:
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)?


Yes, you could override the default block or inline display of
elements using CSS (consult with the c.i.w.a.stylesheets 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
"stylesheets" group.

--
Stanimir

Jul 20 '05 #8

P: n/a
On Fri, 14 Nov 2003 13:58:34 +0200, Stanimir Stamenkov
<s7****@netscape.net> wrote:
yawnmoth wrote:
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)?


Yes, you could override the default block or inline display of
elements using CSS (consult with the c.i.w.a.stylesheets 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?


actually, heh, you're right! good catch! :)
Jul 20 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.