This topic is locked

using checkboxes to add child objects

10/4/2009 10:58:57 PM
PHPRunner General questions
W
wfcentral author

I have three tables...
tbl_gyms (id, gym_name)

tbl_features (id, feature_name)

tbl_features-to-gyms (id, gym_ID, feature_ID)
the client is able to create a list of gyms and a list of features. Then, I have the tables linked so you can add multiple features to each gym.
the client has asked if I could just pull the list INTO the add/edit gym page so it shows up as a list of checkboxes (which would have to pull dynamically from the tbl_features).
Can this be done?
Robert

J
Jane 10/5/2009

Hi,
you can set up feature_ID as Lookup wizard --> Checkbox list on the "Edit as" settings dialog on the Visual Editor tab.

Then parse selected values and save it as separate records in the Before record added event:

http://www.xlinesoft.com/phprunner/docs/select_multiple_values.htm

W
wfcentral author 10/5/2009

okay - that looks like a start, but what happens when they go to EDIT the list? So, if a gym selected 5 features on the first day...then a month later they have a new feature so they go in to edit their listing... would the page show the 5 features they have and let them select the new one? or would they have to select all the features every time they edit their listing?



Hi,
you can set up feature_ID as Lookup wizard --> Checkbox list on the "Edit as" settings dialog on the Visual Editor tab.

Then parse selected values and save it as separate records in the Before record added event:

http://www.xlinesoft.com/phprunner/docs/select_multiple_values.htm

J
Jane 10/6/2009

Hi,
unfortunately edit page won't work with this scheme.

To add new feature/features use add page. To edit features create alias for feature_ID field on the Edit SQL query tab:

select id,

gym_ID,

feature_ID,

feature_ID as feature_ID_edit

from tbl_features-to-gyms



Then check off feature_ID_edit on the edit page only on the Choose fields tab and set up this field as simple dropdown on the "Edit as" settings dialog.

W
wfcentral author 10/26/2009

hi, just got a chance to look back at this project. Is it not possible to make it so they can "uncheck" all features they do not want. I don't see how a dropdown would work... it's not like they are going to change one feature to a different feature. It's more likely they will want to add a new feature and they need to see a page that shows them what is already checked so they can just check the additional stuff they need.



Hi,
unfortunately edit page won't work with this scheme.

To add new feature/features use add page. To edit features create alias for feature_ID field on the Edit SQL query tab:

select id,

gym_ID,

feature_ID,

feature_ID as feature_ID_edit

from tbl_features-to-gyms



Then check off feature_ID_edit on the edit page only on the Choose fields tab and set up this field as simple dropdown on the "Edit as" settings dialog.

J
Jane 10/28/2009

Hi,
You've mixed 'list of values in the field' and 'list of records in the table'.

If you want to save each feature as separate record in the tbl_features-to-gyms table you will work with set of records on the list page (you can delete and edit features for each gym on the list page), not with list of features in one record on the edit page.