Nested FORM

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Nested FORM

Post by alex.barylski »

I could write up some simple HTML and validate it, but...

Does anyone know if this is valid XHTML (transitional)?

Also, If the nested forms are submitted, do they only submit their contained data? Likewise, if the parent FORM is submitted, do all the sub-forms INPUT fields also get submitted?

Just curious...

Cheers :)
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

no, no, and no
User avatar
SpecialK
Forum Commoner
Posts: 96
Joined: Mon Sep 18, 2006 3:49 pm

Post by SpecialK »

You should never use nested forms.

The work around is either using JavaScript to redirect or multiple submit buttons on one form with server side based on the button clicked.

That way all the data can be submitted, but you only need to pull the data that you require and ignore the rest.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

I'll explain my situation a little more :P

I have a master FORM and dynamically generated FORM's each with an arbitrary number of FORM elements.

Code: Select all

Master FORM 
===========
Name: |_______________|

Phone:|___| |___| |___|

Address: |__________________|

[Cancel]  [Save]

Secondary dynamic FORM(s)
==================

Business Website: |_______________|

Personal Website: |_____________|

[Cancel]  [Save]
The secondary FORM(s) may be unlimited...fields are arbitrary as are the number of FORM(s)

I wanted to have a single [Save All] button incase someone changed a field in each FORM, but if nested FORM's aren't allowed I can only think to use AJAX to iteratively save each seperate FORM (or at least those which have modified content)???

Know of a better way, perferably without using javascript?

Cheers :)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Engineer the names such that you don't require multiple forms?
Post Reply