aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Form within a form in Html Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Form within a form in Html" Watch "Form within a form in Html" New topic
Author

Form within a form in Html

Abdul Wahab
Ranch Hand

Joined: Dec 09, 2011
Posts: 49

Hi Ranchers,
Can any one explain why nested form tag (Form within a form) in html will not work. some says that the browser will see it as an single form. I don't get the idea behind these.
please throw some light on it.. thanks


As long as breath left in my body there is hope
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 5018
    
    8

If you were to send someone a letter by post, what is the sense of tearing the letter into two pieces, putting one piece in an envelope, then putting that envelope and the other piece of the letter into another envelope? That's basically what you'd be doing with a form within a form. In either case, somebody is going to wonder what the heck you've been smoking...


Junilu - [How to Ask Questions] [How to Answer Questions]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42608
    
  65
If you look at the HTMl specification, you'll see that there's nothing in it about nested forms. In other words, nested form tags not working is an indicator of nested forms not working. That's by design.


Ping & DNS - my free Android networking tools app
Abdul Wahab
Ranch Hand

Joined: Dec 09, 2011
Posts: 49

Hi,
so what if i have a situation like this,
http://www.coderanch.com/t/603897/Struts/CRUD-operation-struts." target="_new" rel="nofollow">Struts forum
the correct url
http://www.coderanch.com/t/603897/Struts/CRUD-operation-struts
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42608
    
  65
Well, jQuery questions should be asked in this forum, not in the Struts forum. You may want to start a new topic here with all the relevant details (and just those) about how you're trying to submit a form via jQuery and how it's not working.

The relevant part here is that nested forms do not exist, whatever the requirements may be.
Abdul Wahab
Ranch Hand

Joined: Dec 09, 2011
Posts: 49

Ulf Dittmer wrote:The relevant part here is that nested forms do not exist, whatever the requirements may be.

Thanks i got it. but, is there any way i can submit the jquery dialog box values (i have number of text and other fields) to the controller via ajax, i am struggling here , any idea
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42608
    
  65
Ulf Dittmer wrote:You may want to start a new topic here with all the relevant details (and just those) about how you're trying to submit a form via jQuery and how it's not working.
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 5018
    
    8

When you find yourself struggling to make a technology do something, it sometimes helps to step back and rethink your strategy. Rather than trying to force the technology to do something it wasn't designed to do, try to work with the things that it can do. It seems to me that you are fixated on a solution that just isn't possible; try to find some other approach and rework your design.
Abdul Wahab
Ranch Hand

Joined: Dec 09, 2011
Posts: 49

To be clear i need to implement crud operation inside a form,

I converted PageB in to a Jquery Dialog form which is in PageA. Now i need to transfer my dialog values to servlet using ajax. how to try this.



[PageA.jpg]


[PageB.jpg]

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61648
    
  67

Using the jQuery Forms Plugin is one of the easiest ways to submit a form through Ajax.

The code can be as easy as: $('#theForm').ajaxSubmit();


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Abdul Wahab
Ranch Hand

Joined: Dec 09, 2011
Posts: 49

K.how about this ?? can i transfer my Jquery dialog Box values back to the form itself. might be storing in a List or something??? without submitting (post / get)..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61648
    
  67

Why aren't the values already in a form?
Abdul Wahab
Ranch Hand

Joined: Dec 09, 2011
Posts: 49

Sorry Bear, I didn't noticed your first message.
The code can be as easy as: $('#theForm').ajaxSubmit();

I need to submit PageB which is inside PageA . below is my code


Script


form inside form will not work here (as per my understanding). Can i save the dialog values in a list or something without doing POST or GET so that i can submit it when my form1 is posted
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61648
    
  67

No, you can't put a form inside a form. Why does it need to be inside another form?

In any case, the JSF markup is not helpful in this forum. This is not a forum on JSF.

If it's the use of JSF that's causing you to have to create the weird constructs, then I can move this to the JSF forum.
Abdul Wahab
Ranch Hand

Joined: Dec 09, 2011
Posts: 49

No i dont want to use JSF here.. and i am unaware of it too. My requirement is below,
user enters values in a form , hits a button open dialog form which has again a list of values saves it. edit and delete it. finally submit the form.
Is there a way to implement this. i am completely bewildered .
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61648
    
  67

Abdul Wahab wrote:No i dont want to use JSF here.. and i am unaware of it too.

OK, so now I'm confused. Your markup has JSF tags -- if you don't want to use JSF, why are you?

My requirement is below,
user enters values in a form , hits a button open dialog form which has again a list of values saves it. edit and delete it. finally submit the form.
Is there a way to implement this. i am completely bewildered .

If you are using jQuery UI dialogs, the dialog content can go anywhere. It does not need to go inside the other form. Put it near the end of the body.
Abdul Wahab
Ranch Hand

Joined: Dec 09, 2011
Posts: 49

OK, so now I'm confused. Your markup has JSF tags -- if you don't want to use JSF, why are you?

i am using struts1.3 html tag
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61648
    
  67

Hmm, the h prefix is usually used for JSF, but I haven't used Struts in over 10 years so I may just be out of the loop. In any case, put the dialog content somewhere other than in the main form.
Abdul Wahab
Ranch Hand

Joined: Dec 09, 2011
Posts: 49

It does not need to go inside the other form. Put it near the end of the body.

I guess i am getting some light on it. Bear Thank you very much let me try it and come back
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61648
    
  67

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Form within a form in Html