473,395 Members | 1,458 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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=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
8 2468
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
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
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
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
"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
"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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Bob Nolty | last post by:
Hi all -- I'm trying to create a hidden form in the document using only Javascript -- I don't know what form I want until the user clicks a button -- I tried the following code, which does...
4
by: VK | last post by:
09/30/03 Phil Powell posted his "Radio buttons do not appear checked" question. This question led to a long discussion about the naming rules applying to variables, objects, methods and properties...
22
by: Luke | last post by:
Elements with name attribute: form, input, textarea, a, frame, iframe, button, select, map, meta, applet, object, param, img (if you know more reply...) Methods of addresing html elements:...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
6
by: William F. Zachmann | last post by:
We've got a project going that involves moving an old web site with a massive dll written in C++ that produces most of the output from a SQL 7.0 data base on NT4 onto IIS on Windows 2003 Server...
4
by: Sathyaish | last post by:
I am no JavaScript progammer, and unfortunately am having to babysit an old code base that has a lot of JavaScript in it. I have two questions: (1) Can two HTML controls have the same name? It...
5
by: nick | last post by:
I need to create a simple asp.net application that use password protect some html pages. The html page provider doesn't know asp.net. And the host doesn't allow me to create user accounts. ...
7
by: thersitz | last post by:
I can't seem to get my html form to submit properly from within a web form. Here's my form tag syntax and some delivery hidden fields. <form id="myForm"...
19
Atli
by: Atli | last post by:
Introduction At some point, all web developers will need to collect data from their users. In a dynamic web page, everything revolves around the users input, so knowing how to ask for and collect...
1
by: since | last post by:
I figured I would post my solution to the following. Resizable column tables. Search and replace values in a table. (IE only) Scrollable tables. Sortable tables. It is based on a lot...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.