Forums

Table with forms within each row

webbusteruk 17 Dec, 2018
Similar issue to this question on Stack Exchange (https://softwareengineering.stackexchange.com/questions/360992/better-alternative-to-having-a-html-form-with-select-input-on-every-row-in-table)

We'll be very grateful if anyone could suggest a way to do this.

We used CC to display a table containing many rows of data. At the end of each row, we have a dropdown select to allow user to change its status (Submitted, Pending, Finalised). Initially the whole table is enclosed within a form with a submit button, however even if only one row needs changing the whole table will get updated.

The alternative to that is we put a form within each row (under Column Views - status:{view:form} ). Even though this works, it created a form in each row with the same id (which is taken from the form name in CC). There doesn't seem to be a way to remove this id or specify a customised id based on its row. Also, when using this way the following script doesn't work properly:
jQuery(function(){
jQuery('form[data-id:status] select').change(function() {
jQuery(this).closest('form').submit();
});
});
On submit, the form is designed to reload itself via specified Event and Function. However only the first form submission works, subsequent change to the dropdown select does not trigger the above script.

Is there a more elegant way of doing this?
healyhatman 21 Dec, 2018
Have a button instead that pops up a form.
This topic is locked and no more replies can be posted.