 |
 |
Form inside a form? JS form?
|
 |
|
 |
|
Mac Elite
Join Date: Jan 2001
Status:
Offline
|
|
Does having a form inside another form work? If yes, is it not proper coding?
I mean something like this:
Code:
formtag
html...
formtag
html....
endformtag
html...
endformtag
I need this because if the user presses enter after this one particular textbox, I don't want the whole page to get submited.
Also, is there a way to have the form action run javascript code?
Thanks!
P.S. this code function still takes away the form tag, which is why i wrote the code like that
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status:
Offline
|
|
Originally posted by timmerk:
Does having a form inside another form work? If yes, is it not proper coding?
I mean something like this:
Code:
formtag
html...
formtag
html....
endformtag
html...
endformtag
I need this because if the user presses enter after this one particular textbox, I don't want the whole page to get submited.
Also, is there a way to have the form action run javascript code?
Thanks!
P.S. this code function still takes away the form tag, which is why i wrote the code like that
There is a javascript callback on a submit button called "onSubmit" . You can return true/false and it will either submit the form or not based on your wish.
|
|
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Apr 2001
Location: Atlanta, GA, USA
Status:
Offline
|
|
No, you can't have a form inside a form, the first formtag will take precedence. But you can use other logic to see if they leave a form earlier than you want. If there is an actual submit button there it's simple, you just name your submit buttons. If you don't then you'll have to check what fields have data in them to see where they finished off in the form.
Hope that helps,
varcos
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Jan 2001
Status:
Offline
|
|
Ok, thanks for your replies. Any idea how do use onSubmit with this:
http://www.u.arizona.edu/~karlt/admin.php
There is the page I'm working on. In the part where you can add IPs is what I'm talking about. If the user enters an IP to add, but presses "return" instead of clicking add, I don't want the form being submited - even to check after. I need a javascript solution or form inside a form solution, which is not possible, so I'm told.
Ideally, presses "Return" in the add_ip textfield will run the same function as clicking the Add link does, all without ever submiting anything.
Thanks!
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Jan 2001
Status:
Offline
|
|
|
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Feb 2001
Location: Manhattan
Status:
Offline
|
|
try something like this (i have not tested this):
Code:
<input name="add_ip" type="text" id="add_ip" size="16" maxlength="15" onchange="addIP(this.value);">
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Jan 2001
Status:
Offline
|
|
That code half works - it adds the ip to the list box, but then the whole page gets submited after that as well. Any ideas?
Thanks!
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|