Page 1 of 1
How to get "Choice Multiple" values in a display form?
Posted: 07 Feb 2014
by MES5464
I have a multiple choice (checkbox) field and I have been able to get and set the values in code using the insturctions listed on
http://spform.com/forms-designer- ... eld-values
However, I can't find seem to get the value of the field when it is a Display Form.
Re: How to get "Choice Multiple" values in a display form?
Posted: 10 Feb 2014
by Dmitry Kozlov
Hello,
Please, use the following code to get text representation of multiple choice field on a display form:
Code: Select all
fd.field('Choices').control()._el().text();
if it contains multiple values, you can split it by semicolon:
Code: Select all
fd.field('Choices').control()._el().text().split(';')[0]
Re: How to get "Choice Multiple" values in a display form?
Posted: 10 Feb 2014
by MES5464
Thank you so much!
Re: How to get "Choice Multiple" values in a display form?
Posted: 06 May 2015
by GregFitz
Hello, how do I ge the Multiple choice selections to display veritcally (per value) in the display form?
thanks assitance much appreicated as alwys!
Best,
Greg
Re: How to get "Choice Multiple" values in a display form?
Posted: 07 May 2015
by rostislav
Hello,
Use the following code:
var fieldName = 'multipleChoice';
var html = fd.field(fieldName).control()._el().html();
html = html.replace(/;/g, '<br>');
fd.field(fieldName).control()._el().html(html);
Regards,
Rostislav.
Re: How to get "Choice Multiple" values in a display form?
Posted: 11 May 2015
by GregFitz
Excellent thank you! Quick quesiton how would I alter silightly to do multiple fields on same form ?
All the best,
Greg
Re: How to get "Choice Multiple" values in a display form?
Posted: 12 May 2015
by rostislav
You can use this function:
Code: Select all
$.each($('.custom-formatting'), function() {
var html = $(this).children('.fd_control').html()
html = html.replace(/;/g, '<br>');
$(this).children('.fd_control').html(html);
})
where 'custom-formatting' is the css class of the multiple choice field that you set in the Forms Designer (click on the multiple choice field -> on the right you see a table with different attributes for the field -> under LAYOUT find Css Class row -> add a class name, e.g. 'custom-formatting' in this case).
Regards,
Rostislav.
Re: How to get "Choice Multiple" values in a display form?
Posted: 12 May 2015
by GregFitz
Perfect thank you, makes total sense well done.
Again thanks,
Greg