How to get "Choice Multiple" values in a display form?
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.
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.
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hello,
Please, use the following code to get text representation of multiple choice field on a display form:
if it contains multiple values, you can split it by semicolon:
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();
Code: Select all
fd.field('Choices').control()._el().text().split(';')[0]
You can use this function:
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.
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);
})
Regards,
Rostislav.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 18 guests