fd.field('Title').value() delivers ID
In a form we are using:
var status = fd.field('Test').control().value();
to get the value of the lookup-field "Test". This has been working fine for some time, but now status contains the ID of the lookup-field.
Ist it possible to get the shown content of the lookup-field?
Thanks, Wolfgang
var status = fd.field('Test').control().value();
to get the value of the lookup-field "Test". This has been working fine for some time, but now status contains the ID of the lookup-field.
Ist it possible to get the shown content of the lookup-field?
Thanks, Wolfgang
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Hello, Wolfgang!
If you want to get Text, try this instead:
If you want to get Text, try this instead:
Code: Select all
fd.field('Lookup').control('getSelectedText');
Cheers
Sharepoint can drive you crazy:
Now fd.field('Test').control().value() delivers the text I need and
fd.field('Lookup').control('getSelectedText'); delivers nothing
On our test-system with identical lists the second code worked fine.
Looks like we will have to check every morning ...
Thank you, Wolfgang
Now fd.field('Test').control().value() delivers the text I need and
fd.field('Lookup').control('getSelectedText'); delivers nothing
On our test-system with identical lists the second code worked fine.
Looks like we will have to check every morning ...
Thank you, Wolfgang
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
What do you mean by display/edit mode? Can you include screenshots for us to understand better?
Cheers
Hi Nikita,
I meant the change from the display form to the edit by clicking on Edit in the ribbon.
I placed both functions in the javascript code and have added an alert to show the values they deliver.
The alert shows these results when show the item (display form):
"GS" ist the text of the lookup-field that I need
When I click on "edit" in the ribbon, the alert shows these results (edit form):
Thank you, Wolfgang
I meant the change from the display form to the edit by clicking on Edit in the ribbon.
I placed both functions in the javascript code and have added an alert to show the values they deliver.
The alert shows these results when show the item (display form):
"GS" ist the text of the lookup-field that I need
When I click on "edit" in the ribbon, the alert shows these results (edit form):
Thank you, Wolfgang
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 2017
Ah, you are talking about different Forms, I see. Of course, that's because on Display form, it is not an actual Lookup, the field simply displays information, so it requires different code.
But on other Forms - New and Edit, you need to use fd.field('Lookup').control('getSelectedText'); to get text from an actual Lookup.
But on other Forms - New and Edit, you need to use fd.field('Lookup').control('getSelectedText'); to get text from an actual Lookup.
Cheers
-
- Information
-
Who is online
Users browsing this forum: No registered users and 9 guests