Page 1 of 1

Delete a row in subform

Posted: Wed Jan 15, 2020 9:45 am
by mariri
Hi guys !

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

Thanks in advance for ur help !

Re: Delete a row in subform

Posted: Wed Jan 15, 2020 9:53 am
by kev1n
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?

Re: Delete a row in subform

Posted: Wed Jan 15, 2020 2:57 pm
by mariri
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...

Re: Delete a row in subform

Posted: Wed Jan 15, 2020 3:51 pm
by kev1n
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.

Re: Delete a row in subform

Posted: Wed Jan 15, 2020 11:13 pm
by Janusz
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