Delete a row in subform

Questions related to customising nuBuilder Forte with Javascript or PHP.

Delete a row in subform

Postby mariri » Wed Jan 15, 2020 6:15 pm

Hi guys !

Does anyone know how to delete a row in subform whit a custom code ?

Thanks in advance for ur help !
mariri
 
Posts: 45
Joined: Mon Sep 02, 2019 7:24 pm

Re: Delete a row in subform

Postby kev1n » Wed Jan 15, 2020 6:23 pm

Hi,

A record is deleted when the checkbox on its right is ticked and the main form is saved (but I guess you already know that)

Maybe you can describe in a little more detail what you have in mind?
kev1n
 
Posts: 841
Joined: Mon Oct 15, 2018 2:13 am

Re: Delete a row in subform

Postby mariri » Wed Jan 15, 2020 11:27 pm

Like we can add a row in a subform with the Javascript function "nuAddRow()", I would like to remove a row in a subform.
In fact, I would like the removed row in a subform to be added in another subform.

I don't know if it's more clear...
mariri
 
Posts: 45
Joined: Mon Sep 02, 2019 7:24 pm

Re: Delete a row in subform

Postby kev1n » Thu Jan 16, 2020 12:21 am

I see. This is going to be tough. Let's say you want to delete the 3rd row. Then you'll have to shift up all subsequent rows to fill the gap.
kev1n
 
Posts: 841
Joined: Mon Oct 15, 2018 2:13 am

Re: Delete a row in subform

Postby Janusz » Thu Jan 16, 2020 7:43 am

Hi,
To modify/delete/move data on the subform you can for example call JS function by the button(s) placed in the subform rows.
To read data from the specific row and run function you can place in the button onclick something like that:
Code: Select all
var f=nuSubformValue(this, 'your_specific_field_ref'); ...  any-JS-functioon...input boxes ... etc.
or
var a = nuSubformValue(this, 'Oferty_id'); .....any JS code ....  - ID of record - use your specific ref

Next from JS script function (knowing record id - or specific values) you can call php procedure and with mysql you can do with your data whatever you want - update record / delete / move between tables etc.
At the end in the php procedure you can force form refresh like:
Code: Select all
$s="nuGetBreadcrumb();";
nuJavascriptCallback($s);

and the data will be immidiatelly updated/refreshed on your form. You can call as well any specific JS function defined in Header or Custom code JS box.
(the above refresh I use to functions called from the main form - but most likelly it should work from subform as well - but did not test)

Przechwytywanie.JPG
Przechwytywanie.JPG (41.45 KiB) Viewed 1059 times
Janusz
 
Posts: 325
Joined: Fri Dec 28, 2018 10:11 pm
Location: Krakow, Poland


Return to Custom Code