I've used the same technique you describe in order to create a better
form layout. In my case I did not have as many fields, but I did have
a few text areas, which created a "vertically challenged" form.

Same as your approach, I create a form using SQLFORM as per normal and
pass it to the view with return dict(form=form).

In the view, the form is defined without using {{=form}}. Instead, the
form and all inputs are declared in the view and grouped into
appropriate divs, which are shown/hidden based on clicking tabs to
view different sections of the form.

Just be sure to include the hidden fields required by form.accepts in
your form. You can do this by including:

{{=form.hidden_fields()}}

within the form as well as

<input type="hidden" name="id" value="{{=form.record.id}}"/>

if the form is being used to update an existing record.

For the inputs in your form, you can use
value="{{=form.record.yourfieldname}}" as the value of the input field
when updating an existing record. Note that form.record does not exist
if your form is creating a new record, therefore you'll need the
appropriate logic in the view to handle setting the appropriate value
for your input fields.

Not sure if the above is the best strategy, but it is one I have been
using with success.

Ted


On May 5, 10:02 am, JohnMc <maruadventu...@gmail.com> wrote:
> Working on another application. One table in the DAL will have about
> 60 Fields in it. Using one long form would work but gets rather bland.
> I would prefer to visually cut it up. I could either capture the data
> in multiple screens for input or use a tabbed interface to capture the
> data. I am leaning toward the tabbed interface.
>
> The one approach I have considered for a tabbed approach is --
>
> Controller:
>
> Build the form using helper functions and pass as to dict()
>
> View :
>
> Set up the tabs, display the form and use jQuery hide(), show()
> functions using onclick actions to display pieces of the form as
> required.
>
> I would be interested if there might be a better technique to consider
> to achieve the same ends.
>
> Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to