Hi Jake,
You can still use the FormHelper to code the forms and use the same
action, here is an example:
<div id="tab1">
$Form.FormTag("%{id='form1', action='Prestage',
useCurrentRouteParams='true'}")
<fieldset>
<div>$Form.LabelFor("filePrestageData.File", 'File <em>*</em>')
$Form.TextField("filePrestageData.File", "%{id='myId1'}")</div>
<div class="buttonrow">$Form.Submit("Save", "%{class='button'}")</
div>
</fieldset>
$Form.EndFormTag()
</div>
<div id="tab2">
$Form.FormTag("%{id='form2', action='Prestage',
useCurrentRouteParams='true'}")
<fieldset>
<div>$Form.LabelFor("filePrestageData.File", 'File <em>*</em>')
$Form.TextField("filePrestageData.File", "%{id='myId2'}")</div>
<div class="buttonrow">$Form.Submit("Save", "%{class='button'}")</
div>
</fieldset>
$Form.EndFormTag()
</div>
<div id="tab3">
$Form.FormTag("%{id='form3', action='Prestage',
useCurrentRouteParams='true'}")
<fieldset>
<div>$Form.LabelFor("filePrestageData.File", 'File <em>*</em>')
$Form.TextField("filePrestageData.File", "%{id='myId3'}")</div>
<div class="buttonrow">$Form.Submit("Save", "%{class='button'}")</
div>
</fieldset>
$Form.EndFormTag()
</div>
As you can see in the example above, I'm telling the FormHelper what
id to use for the 'FORM' and 'INPUT' html elements.
Does this help?
Cheers
John
On Apr 9, 4:37 pm, jake <[email protected]> wrote:
> Thanks for the help, and somewhat rude comments. I was unaware that
> the monorail param binding was only by name, I was using the
> formhelpers, but just used html to code the form.
>
> Thanks again,
> Jake
>
> On Apr 8, 10:12 pm, Ken Egozi <[email protected]> wrote:
>
> > Jake - notice the difference between id and name.
> > what gets posted from the Form to the server are values *by name*.
> > on the other hand, the element identifier in the DOM is id, which must be
> > singular on a web page.
>
> > so
> > have your three forms, each with the same names for the fields, but with
> > different ids.
> > That is how you do web development.
>
> > now as far as the endpoint on the server, my personal preference is that if
> > you have different forms, they probably serve a slightly different purpose,
> > and I'd have three controller actions (i'd even separate them by name) to
> > deal with them.
>
> > On Fri, Apr 9, 2010 at 12:28 AM, John Simons
> > <[email protected]>wrote:
>
> > > Hi Jake,
>
> > > I think you answered your own question, don't use the same action have
> > > an action per tab.
> > > Eg.
> > > public void ActionForTabs([DataBind("Tab1Data", Validate =
> > > true)]Tab1Data data){}
>
> > > public void ActionForTabs([DataBind("Tab2Data", Validate =
> > > true)]Tab2Data data){}
>
> > > public void ActionForTabs([DataBind("Tab3Data", Validate =
> > > true)]Tab3Data data){}
>
> > > Does this help?
>
> > > Cheers
> > > John
>
> > > On Apr 9, 6:41 am, jake <[email protected]> wrote:
> > > > I'm having an issue with my webpage using javascript and monorail
> > > > param binding. I have a page the uses jquery UI to display tabs, each
> > > > tab has a form that submits to the same action. The issue is that by
> > > > using the same action I am forced to create multiple elements with the
> > > > same ID. This is not only a bad practice, it breaks the javascript
> > > > used for form validation. Any Ideas? I've looked into using an
> > > > identifier, such as element1, element2, and then in my action binding
> > > > element by something like this:
>
> > > > string element = Form["{regex match element%d}"]
>
> > > > I'm looking for a solution that would be more elegant.
>
> > > > Thanks,
> > > > Jake
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups
> > > "Castle Project Users" group.
> > > > To post to this group, send email to
> > > [email protected].
> > > > To unsubscribe from this group, send email to
> > > [email protected]<castle-project-users%[email protected]>
> > > .
> > > > For more options, visit this group athttp://
> > > groups.google.com/group/castle-project-users?hl=en.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Castle Project Users" group.
> > > To post to this group, send email to [email protected]
> > > .
> > > To unsubscribe from this group, send email to
> > > [email protected]<castle-project-users%[email protected]>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/castle-project-users?hl=en.
>
> > --
> > Ken
> > Egozi.http://www.kenegozi.com/bloghttp://www.delver.comhttp://www.musicglue...הכנס
> > הקהילתי הראשון למפתחי דוטנט - בואו בהמוניכם
--
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.