• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple forms in JSP

 
Rick Pellerin
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to have multiple "html:form" in my JSP but it doesn't seems to work...
Is there any restrictions?

I prefered to have multiple forms because I use the Validator framework and use the Client Side JS validation. If I have only one form (and use a DispatchAction), the JS is not valid anymore...My validations are depending on the button pressed.

Thanks
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe there is a restriction to only allow one html:form tag per page.

Is it that some buttons should not cause validation at all or that some buttons do some validation while other buttons do some other validation?
 
Rick Pellerin
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, exactly!

I have a login page with:

a first form (for member) that contain a username/password fields.
a second form (for new member) that contain an activation code field

a third form (for supplier) that contain a username/password fields.
a fourth form (for new supplier) that contain an activation code field

Richard
 
Ray Stojonic
Ranch Hand
Posts: 326
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see anywhere where it states that there's a restriction of the number of html:forms per JSP, it certainly doesn't make any sense to have such a restriction...

Besides, I have several JSPs with multiple html:forms.

I can say that you can only have one html:form per html:form though, in other words: no nesting. (you can do it, but submitting the nested form will cause the outer form to submit, so the whole construct is always submitted and always goes to the same action)
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, so Ray says you can have multiple html:forms on the page.

Does it work when you aren't using the JS validation, Rick?
 
Ray Stojonic
Ranch Hand
Posts: 326
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On rereading my post I note it comes across a bit strong, that wasn't the intent...apologies for any unintended snubbing.

I haven't used js validation, but I have used regular validation, which seems to work just fine despite multiple forms. Each validation definition is tied to a specific ActionForm, and only one form is submitted at a time, so that's not much of a surprise. I would be interested to know how multi js validation works out.
 
Dhan Raj
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ray

I am trying to validate a List attribute (which has two attributes to itself) of a form , but I could not.

My posting is at the following URL(with Details):
http://www.coderanch.com/t/50763/Struts/Validation-List-property-Form

Can u suggest me, how I should do it?

Thanks
Dhan Raj
 
Rick Pellerin
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for the delay...

Everything works OK if I don't use the JS validation...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic