Home > Forum > Forms > Item List callback add new row

Item List callback add new row
0

Hi,

I have problem with adding new row in item list after passed value to existing field in existing value.

on text field I have selected "Invoke callback rules after value change" and in Item list callback rule I add condition , if text value is not empty just add new row.

Wvery time I press button "add new row" I get exception

"After callback form rule of items list:
..
RowNumberCannotBeUndefinedOrEmpty"

Do you know why?

List callback rule does not have "row context" = row number. By using GET ROW VALUE you can get value in of particular column in current row.

Try adding "Form rule to be executed on value change" on list column in Style and behavior tab.
I don't know the whole scenario but "Invoke callback rules after value change" could be unnecessary in this case.


Adding row by "add new row" button creates, by default, list callback so it could lead to infinite loop.

In reply to: Marcin

Jacek, thank you .

Maybe can you give me a suggestion about how add behavior to add new row only when enter key pressed?

It's tricky one :) You have to switch to JS - try something like this:

$("#SubElems_#{WFCON:<listID>}# [data-key='DET_Att2'] input[type='text']").unbind("entK").bind("entK",function(e){
//...do something... call form/js rule...
alert("enter");
});

$("#SubElems_#{WFCON:<listID>}# [data-key='DET_Att2'] input[type='text']").unbind("keyup").keyup(function(e){
if(e.keyCode == 13)
{
$(this).trigger("entK");
}
});

You have to change <listID> and DET_Att2 accordingly.

This rule has to be set on form load and list callback. On form load there will be no html controls of new rows to attach events. Each time the rule will be executed it has to unbind previous events.
I have tried this only on browser console, not from process config.