Page 1 of 1

Choice Field - can you have multiple columns

Posted: 29 Jul 2020
by Roo
Hi

This is a O365 set up.

With the Choice fields I have one i'm setting up at the moment that has a lot of choices (40 ish Multiple options)

Is it possible to make the choice field multiple columns - just two would be great so that the form isn't so long.

(PS I can't split the choices unfortunately)


Thanks

Re: Choice Field - can you have multiple columns

Posted: 30 Jul 2020
by mnikitina
Hello Roo,

Please find the code samples in this thread:
viewtopic.php?f=1&t=376

Re: Choice Field - can you have multiple columns

Posted: 30 Jul 2020
by Roo
I'm using this:
fd.field('Samples_x0020_Required').control()._el().html(content);

var options = fd.field('Samples_x0020_Required').control()._el().find('td');
var content = '<table>';
for (var i = 0; i < 27; i++) {
content += '<tr>';
for (var j = 0; j < 3; j++) {
if (options.length > i + 3 * j) {
content += '<td>' + options.eq(i + 27 * j).html() + '</td>';
} else {
content += '<td></td>';
}
}
content += '</tr>'
}
content += '</table>';
fd.field('Samples_x0020_Required').control()._el().html(content);
Is there any way of blanking the "Undefined" option? my list will grow and shrink in time

Re: Choice Field - can you have multiple columns

Posted: 31 Jul 2020
by mnikitina
Hello Roo,

What do you mean with "Undefined" option? Could you please provide more details.

Re: Choice Field - can you have multiple columns

Posted: 31 Jul 2020
by Roo
its where there isn't a field:
spform1.jpg
spform1.jpg (65.42 KiB) Viewed 7658 times

Re: Choice Field - can you have multiple columns

Posted: 03 Aug 2020
by mnikitina
Hello Roo,

Please try ou this code from the thread:

Code: Select all

var options = fd.field('Option').control()._el().find('td');
var content = '<table>';
for (var i = 0; i < 5; i++) { //Rows
content += '<tr>';
for (var j = 0; j < 6; j++) { //Columns
if (options.length > i + 5 * j) { //Rows
content += '<td>' + options.eq(i + 5 * j).html() + '</td>'; //Rows
} else {
content += '<td></td>';
}
}
content += '</tr>'
}
content += '</table>';
fd.field('Option').control()._el().html(content);
You can change the number of rows and columns.