On the main form there is a button in PHP for filling out the main table. Based on this table, jscript is connected to fill out different tables on the subforms of the main form.
If the result is incorrect, you have to clear the main table and several subordinate tables.
The tables have checkboxes to delete a row, but deleting one row at a time is not practical. I would like one button.
I tried to delete rows based on a certain criterion in PHP, but this was also unproductive.
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
How to programmatically clear a table on a subform.
Re: How to programmatically clear a table on a subform.
Hi kknm,
If you use JavaScript you can tick all Subform records to be deleted when you save the record next.
This function will tick all the Delete boxes on a Subform.
subform('task_sf');
Steven
If you use JavaScript you can tick all Subform records to be deleted when you save the record next.
This function will tick all the Delete boxes on a Subform.
subform('task_sf');
Code: Select all
function tick_subform(s){
$( "[id|='" + s + "'], [id$='nuDelete']" ).prop('checked', 'checked');
}
Steven
You do not have the required permissions to view the files attached to this post.
A short post is a good post.
-
- Posts: 366
- Joined: Sat Apr 11, 2020 12:03 am
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Re: How to programmatically clear a table on a subform.
When placing this code on the main form -
the function marks all Checkboxes on all subforms.
How to make a selection for one subform on the main form?
the function marks all Checkboxes on all subforms.
How to make a selection for one subform on the main form?
-
- nuBuilder Team
- Posts: 4292
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: How to programmatically clear a table on a subform.
Try:
Code: Select all
function tickSubform(formId){
$(`[id^='${formId}'][id$='nuDelete']`).prop('checked', 'checked');
}
-
- Posts: 366
- Joined: Sat Apr 11, 2020 12:03 am
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Re: How to programmatically clear a table on a subform.
It seems to me that there is a typo in the formula - an incomprehensible symbol after id - Chr(94)?
The absence of a comma, which is in the first formula.
I tried to put signs as in the first formula, getting nuFormId('sub_vup') - all subforms are marked.
The absence of a comma, which is in the first formula.
I tried to put signs as in the first formula, getting nuFormId('sub_vup') - all subforms are marked.
-
- nuBuilder Team
- Posts: 4292
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: How to programmatically clear a table on a subform.
I tested my function in the Access Levels form and it works fine. (Latest Chrome, Firefox, Edge)
Code: Select all
function tickSubform(formId){
$(`[id^='${formId}'][id$='nuDelete']`).prop('checked', 'checked');
}
tickSubform('accform');
-
- Posts: 366
- Joined: Sat Apr 11, 2020 12:03 am
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Re: How to programmatically clear a table on a subform.
All my subforms are of GRID type.
Maybe I'm defining formId incorrectly, because with the first formula all subforms (GRID) are marked.
How to get the formId of the desired subform from the main form?
Maybe I'm defining formId incorrectly, because with the first formula all subforms (GRID) are marked.
How to get the formId of the desired subform from the main form?
-
- nuBuilder Team
- Posts: 4292
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: How to programmatically clear a table on a subform.
Select 'Subform Object' from the subform options menu.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 366
- Joined: Sat Apr 11, 2020 12:03 am
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Re: How to programmatically clear a table on a subform.
Thanks, I figured it out!
I incorrectly used object_id instead of subform id.
I incorrectly used object_id instead of subform id.