• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Multiple forms in JSP

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 326
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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):
https://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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry for the delay...

Everything works OK if I don't use the JS validation...
 
Everybody's invited. Except this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic