473,395 Members | 1,999 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.

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

Similar topics

5
by: Markus Ernst | last post by:
Hi I have a validation problem with a form and nested divs. I understand what the problem is, but I don't see how to fix it. This is my normal page structure, and it validates: <!DOCTYPE HTML...
1
by: oncewaswillow | last post by:
Hi, I have 3 nested forms and want to calculate a total on the first subform (as the form loads)by adding 2 fields from that form + to a field on the second subform. Second subform is and...
10
by: nimmi_srivastav | last post by:
Below you will see an example of a nested conditional expression that this colleague of mine loves. He claims that it is more efficient that a multi-level if-else-if structure. Moreover, our...
5
by: ~~~ .NET Ed ~~~ | last post by:
Hi, As you all know when an ASP.NET web form is created that will include web controls and such, it contains a FORM that that identifies the web form and its containing controls. Well, I have a...
0
by: question | last post by:
Hi! I have a requirement where I need to display multiple forms one after the other like a slide show. These are in the same application. Basicall on selection of a menu item it should start...
8
by: Ragbrai | last post by:
Howdy All, I have a query that is used for filtering results to be used in a combo box. The query needs to test fields from both a table and then unbound text boxes on the form that also contains...
5
by: Jake K | last post by:
What purpose does nesting a class inside another class typically server? Are there conditions where this would be beneficial? Thanks a lot.
16
by: koutoo | last post by:
I start my code with some constants then a while statement. But I have some For statements towards the end within the While statement where I start getting some errors. I'm hoping I won't have to...
4
by: Patrick A | last post by:
All, I rely on nested IF statements with multiple conditions heavily, and someone suggested recently writing the statements (and especially reading them months later) would be much easier if I...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.