Related-items Get Column Id

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
ksertkaya
Posts: 87
Joined: Wed Nov 18, 2015

19 Apr 2018

Hi,

1.How do I clear all textbox in table with code?
Screenshot_5.png
Screenshot_5.png (67.39 KiB) Viewed 1756 times
2. How do I get column id of first column in related-item?
Screenshot_4.png
Screenshot_4.png (24.08 KiB) Viewed 1756 times
Thanks in advance.

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

19 Apr 2018

Dear Sertkaya,
1) To empty value of several text fields inside one table, first give this Table a CSS class like my-table, then use the following code:

Code: Select all

$('.my-table').find('.fd_field input').each(function(){
    this.value = '';
});
2) If you try to get the ID, try the following code:

Code: Select all

fd.relatedItems(0).data('ctx').ListData.Row[0].ID;
If not ID, but another field, just replace ID with the Internal name of the field. If you have more than one Related Items control, replace 0 in relatedItems() with the number of the correct Related Items control.
Cheers

ksertkaya
Posts: 87
Joined: Wed Nov 18, 2015

19 Apr 2018

Thanks Nikita.

Another question :

How do I set required(Not just asteriks) one field with code? Is it possible?

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

19 Apr 2018

Dear Sertkaya,
No, unfortunately it's not possible to make field mandatory with JavaScript. What you can do is use JavaScript validation instead of default SharePoint validation. Read more about it here - https://spform.com/javascript-framework ... ynamically
Cheers

ksertkaya
Posts: 87
Joined: Wed Nov 18, 2015

20 Apr 2018

Hi again,

I try to get id/value from lookup but I can't.

alert(fd.relatedItems(0).data('ctx').ListData.Row[0].Okul);
Screenshot_8.png
Screenshot_8.png (28.69 KiB) Viewed 1739 times
Screenshot_7.png
Screenshot_7.png (6.76 KiB) Viewed 1739 times

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

20 Apr 2018

Dear Sertkaya,
What type of field are you trying to get?
Cheers

ksertkaya
Posts: 87
Joined: Wed Nov 18, 2015

20 Apr 2018

Lookup.

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

20 Apr 2018

Dear Sertkaya,
Try the following code for Lookup instead:

Code: Select all

fd.relatedItems(0).data('ctx').ListData.Row[0].FIELD_NAME[0].lookupValue;
Cheers

ksertkaya
Posts: 87
Joined: Wed Nov 18, 2015

20 Apr 2018

Thanks a lot!

ksertkaya
Posts: 87
Joined: Wed Nov 18, 2015

27 Apr 2018

Hi again,

My code is not working. CSS name of my table is 'Kaza'

Code: Select all

$('.Kaza').find('.fd_field input').each(function(){
    this.value = '';
});

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 26 guests