469,290 Members | 1,887 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,290 developers. It's quick & easy.

Nested Forms: How can I escape them?

pk
Let me start off by mentioning that I'm not a web developer by any
means. I welcome any and all tips regarding code cleanliness and would
love to hear about any conventions that I'm breaking.

I have a page here that I've broken down to its simplest (that i know
of) elements so it is easier for you guys to follow along.

http://www.bigkaiser.com/phil/test.html

If you look closely, you'll see that I have an instance of nested
forms. I don't know how to get around this. The reason for this is
that I need the form that is nested inside, "myform", controls a
dynamic element in the greater form "kpt". When one chooses "Rough"
from the "Boring Type:" selection dropdown, another dropdown appears
below. I don't know how to get this behavior without creating a form.
I need the "kpt" form because it ultimately sends information to my SQL
Server backend and returns the query results. (This part was working
before I added the interior form.)

Now, what are my options? Please be verbose. :) Again, any comments
on code cleanliness are welcome, I'd like to learn clean code early on
rather than have to change my ways.

-pk

Sep 1 '05 #1
2 3038
pk schrieb:
Let me start off by mentioning that I'm not a web developer by any
means. I welcome any and all tips regarding code cleanliness and would
love to hear about any conventions that I'm breaking.

I have a page here that I've broken down to its simplest (that i know
of) elements so it is easier for you guys to follow along.

http://www.bigkaiser.com/phil/test.html

If you look closely, you'll see that I have an instance of nested
forms. I don't know how to get around this. The reason for this is
that I need the form that is nested inside, "myform", controls a
dynamic element in the greater form "kpt".
Why are you trying to nest forms? Forms must not contain other forms. There's
*no* reason for nesting forms.
When one chooses "Rough"
from the "Boring Type:" selection dropdown, another dropdown appears
below. I don't know how to get this behavior without creating a form.
Very simple: allmost in the same way you did, but without the inner form.
I need the "kpt" form because it ultimately sends information to my SQL
Server backend and returns the query results. (This part was working
before I added the interior form.)
well, no wonder :)
Now, what are my options? Please be verbose. :) Again, any comments
on code cleanliness are welcome, I'd like to learn clean code early on
rather than have to change my ways.

-pk


Well, althoug I haven't understood the problem,

Just leave away the inner form, shouldn't change anything in functionality.

And if you want to get it working here's a hint: In the script, you chose the
dropdown by

document.getElementById("Finish").selectedIndex;

Well, that's OK so far, but the dropdown hasn't an ID:

<select name="Finish" onchange='able(this);'>

So change this to

<select name="Finish" id="Finish" onchange='able(this);'>

And you're fine (If you allready removed the inner form which is useless).

Greetings,

Martin
Sep 1 '05 #2
ASM
pk wrote:
Let me start off by mentioning that I'm not a web developer by any
means. I welcome any and all tips regarding code cleanliness and would
love to hear about any conventions that I'm breaking.
a form can't be in a table
a form can be in a cell
a form can contain a table
does a form can be in an other form ?
I have a page here that I've broken down to its simplest (that i know
of) elements so it is easier for you guys to follow along.

http://www.bigkaiser.com/phil/test.html

If you look closely, you'll see that I have an instance of nested
forms. I don't know how to get around this. The reason for this is
that I need the form that is nested inside, "myform", controls a
dynamic element in the greater form "kpt".
form 'myform' has any action
why selects (hidden and visible) can't be in main form kpt ?

When one chooses "Rough"
from the "Boring Type:" selection dropdown, another dropdown appears
below. I don't know how to get this behavior without creating a form.
I need the "kpt" form because it ultimately sends information to my SQL
Server backend and returns the query results. (This part was working
before I added the interior form.)


What secondary select send, your SQL query must analyse it
Do your query relatively to those results

Why to not only use 'kpt' ?

<form action="insertselector.php" name="kpt" method="post"
target="stkdata" style="font-family:comic sans ms; color:#000;>
<table border="1" width="615">
<tr>
<td style="text-align:right" width=117>Boring Type:</td>
<td><select name="Finish"
onchange="var k = this.selectedIndex;
if(k==1) {
document.getElementById('BalStepDiv1').style.displ ay = 'inline';
}
else {
BalStepVal.selectedIndex = 0;
document.getElementById('BalStepDiv1').style.displ ay = '';
}
">
<option></option> <option>Rough</option>
<option>Finish</option>
</select>
<span id="BalStepDiv1" style="display:none;color:red">
Balance or Step :
<select name="BalStepVal">
<option></option>
<option>Balanced Cutting</option>
<option>Step Cutting</option> </select>
</span>
</td>
</tr>
<tr><td>...</td><td> ... </td></tr>
</table>

if 'Rough' is chosen
span 'BalStepDiv1' is displayed :
- text (balance)
AND
- select 'BalStepVal'
are shown

if not 'Rough' is not chosen,
- span 'BalStepDiv1' is none displayed : (text and select disappear)
- options of BalStepVal are set to first one (no text, no value)
your sql query must do something with this '0' or ''
or must not ? as you like.

Absolutly no need all those divs
while you use a table to arrange your elements
Absolutly no need all those font="face color ..." once is enough
use style insteed

--
Stephane Moriaux et son [moins] vieux Mac
Sep 1 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Markus Ernst | last post: by
1 post views Thread by oncewaswillow | last post: by
10 posts views Thread by nimmi_srivastav | last post: by
5 posts views Thread by ~~~ .NET Ed ~~~ | last post: by
reply views Thread by question | last post: by
5 posts views Thread by Jake K | last post: by
16 posts views Thread by koutoo | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.