Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Input tags with out a Form tag 3

Status
Not open for further replies.

scc

Programmer
Apr 30, 2001
218
0
0
US
I have inherited some code that has 3 or 4 input tags that were used to create buttons, but there is no form tag.

I haven't found anything that said the input tags could be used this way. Will this come back to "bite" me?

Thanks!
 
in netscape it will, it doesnt like inputs on a page that has no form, IE is alot more forgiving
 
You can simulate a text input like this:
<textarea rows=&quot;1&quot; cols=&quot;40&quot; style=&quot;overflow:hidden;&quot;>
WhateverTextYouLike
</textarea>

You can simulate a button input like this:
<button>
MoreTextYouLike
</button>

Both can be named and used like the other ones.

Rick
 
Ooooh! Good stuff!

Does the textarea and button tags need to be inside a form tag?

BTW, I did test the original code in Netscape (it was either 6.1.2 or 6.2.1 - it's at work) and it worked fine. Perhaps it would choke on earlier versions. I'm just hesitant to leave it as is as it seems like it could rear it's ugly head sometime/somewhere and cause me grief.
 
I think without using the form tag, one can use input tags easily. I used it several times. Like ...

<input type = button>

and etc etc ....

Didn't try in netscape. Momin ho to bay taigh bhee lerta hay sipahee
 
That's what's so good about <button>I'm a button!</button> and <textarea>Please write something here...</textarea>. They can be used anywhere--one problem. I just found out that <button> is only IE 4+ and NS 6+. Too bad...At least <textarea> was on both IE 1 and NS 1. That can be used fine anywhere. If I have helped you just click the first link below to let me know :)
 
Hmmm... this is another button that works without a form...

<input type=&quot;button&quot; value=&quot;Click me!&quot; onclick=&quot;javascript:alert('Boo!');&quot; />

Works in IE 5 and Netscape 6, no problem. Not sure about other browser versions, though...

This should be able to trigger any javascript functions.

JavaKat
 
That's the thing. All <input>'s work in IE 6.0 for me(and earlier versions of IE too, I think). It's just that we're looking for things that will work in earlier NS editions.

Rick If I have helped you just click the first link below to let me know :)
 
The thing is, all of these elements where originally intended solely for use in forms (except button? it was made later i think). Thus, older browsers may not support them without the <form> element as a parent. But then, why does this matter so much? Just include <form> and </form> anyways... they don't change anything the functioning of your page!

However, in answer to scc's fears, there is really no need to worry about the use of these elements for future browsers, since nowadays they are used with client-side scripts more often than with traditional form processors (ie. CGI, perl, etc.). All new browsers will recognize this and thus not require them to be part of an official form. &quot;Insofar as the propositions of mathematics refer to reality they are not certain, and insofar as they are certain they do not refer to reality.&quot; -- Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top