Title: Nachricht
You can play around with a subform and  db:checkbox. Then you have the right picture to edit the user.
For the new user you can use the same and try to fill the subform with some default data.
The only problem is how to show a subform with values in insert mode. I never try this.
 
The other way is first generate the new user, add data to the user_roles tables in an afterInsert interceptor and show the same record again.
Now the subform is filled with data.
 
This is the way i used in part data forms where i have nearly the same problem.
 
Or you use a db:checkbox group filled by queryData. Query data must be something of a union table filled by all records from user_roles and roles.
Now you need an afterInsert/afterUpdate interceptor to walk through the list of checkBoxes see wich values are set and put this into the database.
 
Best would be to delete all records from user_roles for the given user an then reinsert the new values because you will not get the value of an unsetted checkBox.
 
Cheers
Henner
 
-----Urspr�ngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Neal Katz
Gesendet: Dienstag, 10. August 2004 15:49
An: [EMAIL PROTECTED]
Betreff: [dbforms] Checkboxes

Does anyone have an easy way to implement the following:

 

I have 3 tables users (user_name,user_pass)  ,  roles ( role_name )  and user_roles ( user_name , role_name ).

 

I want to have an input screen where I prompt for a user_name, and then show a set of checkboxes for each entry in the role table.

 

After the user commits, the system will create a new record in the users table and additional records in the user_roles table, one for each role selected.

 

 

I’m asking because all I can think of is bunch of brute force ways to do this, involving writing a custom controller. I like to avoid that if possible.

 

Thanks in advance

 

Neal

 

p.s. if this looks familiar it’s the standard tomcat schema for setting up a realm for authentication.

Reply via email to