Field returns undefined

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
Phoenix
Posts: 23
Joined: Wed Dec 10, 2014

17 Feb 2015

Hi there


I have a 'YesNo' Field and I would like to check if it is selected. I have following code:

fd.field('Other_x0020_baseware_x002d_users').readonly(false);

alert(fd.field('Other_x0020_baseware_x002d_users').value());


I do get undefined as alert...what did I do wrong?

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

17 Feb 2015

Hi,

Is it a new, edit, or display form? If the field is rendered in the read only mode, you should use the following code to get its value:

Code: Select all

fd.field('Other_x0020_baseware_x002d_users').control()._el().text()

Phoenix
Posts: 23
Joined: Wed Dec 10, 2014

17 Feb 2015

Thanks. It is in the Edit form. Should I then compare it with value 'yes' or 'no' order with boolean oder 0 and 1?

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

18 Feb 2015

Could you send HTML-source of your form page to support@spform.com? Thanks!

Phoenix
Posts: 23
Joined: Wed Dec 10, 2014

18 Feb 2015

Hi

It works perfect thanks. I compared it with 'Yes' an 'No'

Phoenix
Posts: 23
Joined: Wed Dec 10, 2014

18 Feb 2015

hi there..... I have a another problem with multiline rich textfield

although I found this post in the forum it is not working for me.


when i do the following:


fd.field('Justification').control()._el().find('div.ms-rtestate-write').text().replace(/\W/g, '');

if (!fd.field('Justification').control()._el().find('div.ms-rtestate-write').text()) {

....

It will not enter the if statement when Justification is empty. When I add Trim.....it deletes all the text in Justification.... What did I do wrong?

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

20 Feb 2015

Please, make sure that you pass the correct internal name of the field into fd.field() method. Also ensure that the type of field is Rich Text, not Enhanced Rich Text or Plain Text.

Phoenix
Posts: 23
Joined: Wed Dec 10, 2014

20 Feb 2015

Hello Dimitry


Thanks. I actually do use an enhance richt text field. It works now, when I use this code:

var text = fd.field('Justification').control()._el().find('div.ms-rtestate-write').text().replace(/\W/g, '');

if (text == '') {


...

}


Apparenty, I have to save the result of the method replace in a variable, otherwise it is not working...

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 15 guests