This topic is locked

Multiple chosse checkboxes

7/25/2011 9:07:02 AM
PHPRunner General questions
W
webdino author

Hello,

I want to create a page that allows the user to check multiple checkboxes and save them
I have a table customer with name and ID

I have a table place with name and ID

and I have a table assignment with ID, customerID and placeID
when I create a join SQL then the page lists all individually records in many lines

Thats no problem, but when I will change the assignet places to the customer I must change each individually record or create new record for new place.
I want to have an edit page where I choose the customer and then all places are shown as a checkbox and I can activate them or not. Then I can save the checked places for this customer in one page.
thanks for help

C
cgphp 7/25/2011

webdino,

  1. create an alias field in the customer table
  2. select this new alias field only for the add page
  3. set this new field, in the add page, as lookup wizard (checkbox list) http://xlinesoft.com/phprunner/docs/lookup_wizard.htm
  4. in the before record added event, explode the posted value of the new alias field:

$checkbox_values = explode(",",$values['new_alias_field']);



5. save the $checkbox_values array and the ID of the user with some sql update statements in the assignment table

W
webdino author 7/26/2011

thank you, but can I show in the list page than only one value with all settet places or are there then many values in many lines?

C
cgphp 7/26/2011

Using a custom field you can have many values for each field in each row.

W
webdino author 7/26/2011

the field value is empty when I post var_dump($aliaszuordnung) the array is null

C
cgphp 7/26/2011

webdino,
to access a field value in the in the "before record added" event use:

$values['aliaszuordnung']



so, your statement becomes:

var_dump($values['aliaszuordnung']);
W
webdino author 7/26/2011

I will try it.

Thanks
Is there otherwise a projekt from the standard ready projects of PHPR with an example?
cars, events, jobs, application and so on?

W
webdino author 7/26/2011

is it otherwise possible to make a dropdown box with customers that display only values that are values excluded
for example
SELECT zuordnung.customer, customer.Name

FROM customer.kunde kunde

INNER JOIN

customer.zuordnung zuordnung

ON (customer.ID <> zuordnung.customer)

C
cgphp 7/26/2011

Create a view in your db manager (not a custom view in phprunner). Then you can select that view for the lookup wizard.