Rig up the onchange of the message type dropdown to the load function...
On Monday, August 5, 2013 1:00:45 PM UTC-7, Michael Beller wrote:
>
> I have a requirement to create a message based on the user selecting a
> message type. Each message type has a fixed text component and a set of
> zero, one, or more variable components.
>
> Ideally, I'd like the user to select the message type from a list and have
> the form dynamically display zero, one, or more fields for entering each
> variable component without posting back the entire page. I've researched
> LOAD and Ajax options in the book, along with using a field type of
> list:string, but I haven't defined a good approach. I've also read about
> the conditional fields but not how to have a dynamic set of conditional
> fields.
>
> Worst case, I could just postback the form and display a page with the new
> form for that message type (and make the message type read only).
>
> Any ideas? Thanks.
>
> Here is the base model ...
>
> db.define_table('msg_typ',
> Field('msg_typ_id'),
> Field('msg_typ_name'),
> Field('msg_typ_body'),
> Field('msg_typ_vars', type='list:string'),
> format='%(msg_typ_name)s',
> migrate=True)
>
> db.define_table('msg',
> Field('msg_typ', type='reference msg_typ'),
> Field('msg_vars', type='list:string'), # ideally, this would be a
> dictionary with the vars from the msg_typ table along with their values
> migrate=True)
>
>
>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.