Good day fellow Trongate users.
I have a situation where I need to have a master form which displays a sub form which may have one or more related records.
I have created the forms using Trongate modules but I am stumped as to how to implement this.
Using javascript I can create the multiple instances of the sub form by appending the sub form's raw html to its parent div container, but I lose the php functionality when done this way.
Even if this approach were to work, I still am clueless as to how I would collect and insert the data from the sub form instance(s) to the database.(Maybe using Trongate's batch insert method is viable).
If anyone has successfully tackled a similar issue, any pointers or guidance will be appreciated.
Cheers!
Multiple instances of a subform in a master-detail view
4 years ago
4 years ago
#1
4 years ago
#2
Hi KeepCalm,
Think of it the same way you would do it in VBA. I assume you have separate tables in your database that relate to each other? From the view file call the methods in your controller that update what ever record needs updating, then redirect to update your view.
You may also try reading up on modules calling modules > https://trongate.io/docs_m/information/calling-another-module-from-a-controller
Think of it the same way you would do it in VBA. I assume you have separate tables in your database that relate to each other? From the view file call the methods in your controller that update what ever record needs updating, then redirect to update your view.
You may also try reading up on modules calling modules > https://trongate.io/docs_m/information/calling-another-module-from-a-controller
4 years ago
#3
Good day to you Simon,
I do have related tables and I guess updating them would not be difficult, I am more so stumped at how to implement the visual display as I would like to give the user the option to add (or remove) as many sub forms as needed, while keeping the aesthetics of the main form.
I have the main form split across three cards using the three column css class.
The sub forms (there are two to be added, one having only one related record but the other may contain many related records) have to be in the middle column due to how the client's data entry process is done.
In VBA I can easily use continuos forms and tabs to fit within a similar layout but I am realizing that web layout for forms is a different kettle of fish to that of VBA desktop.
I will check out the calling of the modules from the view and let you know of my progress.
Cheers!
I do have related tables and I guess updating them would not be difficult, I am more so stumped at how to implement the visual display as I would like to give the user the option to add (or remove) as many sub forms as needed, while keeping the aesthetics of the main form.
I have the main form split across three cards using the three column css class.
The sub forms (there are two to be added, one having only one related record but the other may contain many related records) have to be in the middle column due to how the client's data entry process is done.
In VBA I can easily use continuos forms and tabs to fit within a similar layout but I am realizing that web layout for forms is a different kettle of fish to that of VBA desktop.
I will check out the calling of the modules from the view and let you know of my progress.
Cheers!
4 years ago
#4
Hello,
Is this for viewing data?
I think to do this you retrieve all the data in the controller and pass it to the view. Then within the column use div's to display the related data.
In your second card, Middle column, add another card that has the one related record, then add another card that has the many related records.
Or is this for user input?
Is this for viewing data?
I think to do this you retrieve all the data in the controller and pass it to the view. Then within the column use div's to display the related data.
In your second card, Middle column, add another card that has the one related record, then add another card that has the many related records.
Or is this for user input?
4 years ago
#5
Hi djnordeen, thanks for your response,
This would be for user input, I can display the data as you suggested, but I am stuck at how to work out the adding of new sub forms for user input.
Cheers!
This would be for user input, I can display the data as you suggested, but I am stuck at how to work out the adding of new sub forms for user input.
Cheers!
4 years ago
#6
I believe you can use a modal widow. Put an input field for the user to add info, when they click on the input field, then the modal pops up, when finished you have the info in the input field.
4 years ago
#7
I can visualise that working with a modal Dan - good suggestion :)
KeepCalm, if it helps we can continue this thread on the SCA forum at https://ums.myds.me/phpbb/index.php to allow you to share screen shots, attachments, video as this help-bar is a little restrictive in that part. It's a closed forum as I was getting so many bots and spammers - please email me via the contact form
KeepCalm, if it helps we can continue this thread on the SCA forum at https://ums.myds.me/phpbb/index.php to allow you to share screen shots, attachments, video as this help-bar is a little restrictive in that part. It's a closed forum as I was getting so many bots and spammers - please email me via the contact form
4 years ago
#8
I have been reconsidering this approach after consulting with the client.
It seems like I would have to add all the sub forms' fields to the main table (view) and have a very long data entry form,
which was what I was trying to avoid in the first place.
I guess I would have to break the form up into sections and show and hide sections as required.
Thanks djnordeen and Dafa for both of your input.
I guess djnordeen's modal suggestion may be one practical approach that would be (relatively) easy to implement for someone in this scenario.
Cheers!
It seems like I would have to add all the sub forms' fields to the main table (view) and have a very long data entry form,
which was what I was trying to avoid in the first place.
I guess I would have to break the form up into sections and show and hide sections as required.
Thanks djnordeen and Dafa for both of your input.
I guess djnordeen's modal suggestion may be one practical approach that would be (relatively) easy to implement for someone in this scenario.
Cheers!