This topic is locked
[SOLVED]

 Edit child records from master edit page

5/26/2011 9:18:23 AM
PHPRunner General questions
T
text author

I've done a fair bit of searching on the forums and cannot seem to find the answer I'm looking for.
I have successfully been able to add to child records using a checkbox from the example in the manual here http://xlinesoft.com/phprunner/docs/select_multiple_values.htm
What I am looking for is an elegant way to edit (using checkboxes) those records from the master edit page. I know I can include the child records at the bottom of the page and enable inline edit but the location and the method are not great.
I'm happy to custom code but am wondering what the best way of adding that code onto the page would be.
Thanks
Richard

Sergey Kornilov admin 5/26/2011

I guess you need to provide more clear example of what you trying to achieve.
The example you referring to doesn't have anything with editing or with UI. It simply shows how to handle multi-select edit control a different way.
Better yet, supply a a screenshot that explains what you trying to build.

T
text author 5/27/2011

Thanks Sergey
A simple example would be if you were editing a student record. So in the main "student" table the fields on the edit page might be:
Name

Address

student id
on the same edit page I would like to be able to have a row with check boxes per subject (eg Maths, English, Physics) which come from a "subject" table and when checked/unchecked would update a "student_subject" table.
Like I said in my previous post I achieved this on an add page by using the insert multiple records example in the manual but am not sure how to achieve the ability to edit the subjects that a student from the main student edit page.
Hope that makes it more clear
Thanks
Richard



I guess you need to provide more clear example of what you trying to achieve.
The example you referring to doesn't have anything with editing or with UI. It simply shows how to handle multi-select edit control a different way.
Better yet, supply a a screenshot that explains what you trying to build.

J
Jane 5/27/2011

Hi,
you can use the similar code in the Edit page: Before record updated event for this purpose.

For example you can remove all records in the detail table for current master record and then re-add selected values again.

T
text author 5/27/2011

Thanks Jane - the problem with that approach I think is that it does not allow the person editing the record to see what was previously checked does it ?



Hi,
you can use the similar code in the Edit page: Before record updated event for this purpose.

For example you can remove all records in the detail table for current master record and then re-add selected values again.

L
Lena 5/27/2011

Hi,

as workaround you can add dummy varchar field "student_subjects" to the student table.

Save subject ids for each student in the field.

Then set Lookup wizard as checkbox list in the "Edit as settings" for student_subjects field on the student Add/Edit pages on the Visual Editor.
Also there is a way to create custom control on the edit page, select values from detail table and create custom checkbox list with selected values. Actual code is dependent on your database structure.

If you want to implement this scheme publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions of you you want to achieve.

T
text author 5/27/2011

Solved - thanks Lena, your suggestion worked. Just needed to link to subject table.
Hi Lena
Thanks very much, I thought you had the answer with the dummy field but of course by linking it to the student_subjects table rather than the subject table the only check boxes that appear are the ones where there is a value in the table i.e. you wouldn't be able to add a new subject.
I'm either going to have to rethink this or create a custom page outside of phprunner.
thanks
Richard



Hi,

as workaround you can add dummy varchar field "student_subjects" to the student table.

Save subject ids for each student in the field.

Then set Lookup wizard as checkbox list in the "Edit as settings" for student_subjects field on the student Add/Edit pages on the Visual Editor.
Also there is a way to create custom control on the edit page, select values from detail table and create custom checkbox list with selected values. Actual code is dependent on your database structure.

If you want to implement this scheme publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions of you you want to achieve.