detect event on many fields

detect event on many fields

UMR5558UMR5558 Posts: 41Questions: 13Answers: 0

Hello everybody.
In my editor, I have several fields whose name begin in an idetical way. I would like to detect an event change on all fields.

editor.field('sample_numbers.sample_Feces').input().on('change', function() {
show_samples($(this));
});
editor.field('sample_numbers.sample_Hair').input().on('change', function() {
show_samples($(this));
});
editor.field('sample_numbers.sample_T').input().on('change', function() {
show_samples($(this));
});
Is it possible to detect all fields whose name begin by 'sample_numbers.sample_ '

editor.field( begin by 'sample_numbers.sample_ ').input().on('change', function() {
show_samples($(this));
});

How can i do this ?

Thanks for your help.
Lionel

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Is it possible to detect all fields whose name begin by 'sample_numbers.sample_ '

    No sorry. There is no multi-field API in Editor at the moment. Best option is to have an array of the field names and then loop over that.

    Allan

  • UMR5558UMR5558 Posts: 41Questions: 13Answers: 0

    Thanks a lot. Allan.

This discussion has been closed.