fd.field().value() not working

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
Felix Müller
Posts: 10
Joined: Mon Mar 10, 2014

29 Jan 2015

Hi,

I have a form with an lookupfield called Ticket. I try to set die lookupfield with javascript with the help of a url parameter. My javascrpt is the following:

//check if my custom parameter ParentID is set
var parentID = 5;
if (parentID) {
//parentID is set
var ret = fd.field('Ticket').value(parentID);
//check if the setting was succesful
if (parentID == ret.value()) {
$('.ticket-field').hide();
} else {
alert(parentID + " - " + ret.value());
}
}

When I open the form with following url (ie. from a related item list) the ticket field is succesfully set:

http://server/Lists/Ticketaufgaben/fd_T ... e%26ID%3D5

When I open the form with following url (ie. from a user defined action) the alert box is telling me that setting the value was not successfull.

http://server/Lists/Ticketaufgaben/fd_T ... fcb607d26e

The only difference between the two URL is the ID parameter in the source parameter.

I see no reason thy it is necessary to have an ID parameter in the source paramter just to do the fd.field('Ticket').value(parentID);

Can you tell me what I did wrong?

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

29 Jan 2015

Hi,

I cannot find where you retrieve a query parameter in your code. Please, make sure that the source code of your form page contains the JavaScript you've published here. Most likely that you use fd.getSourceID function to get the parent ID because it extracts ID of the parent item from the Source parameter of the query string.

Felix Müller
Posts: 10
Joined: Mon Mar 10, 2014

29 Jan 2015

Hi Dmitry,

I simplyfied the code to point the finger to the problem. In my demo code I set the variable statically to 5 which is a valid ID in my testsystem. When I open the form containing exactly the code above with the URLs mentioned above I can see the described behavior.

The problem seems to be that the value() method somehow runs into an error, when the ID parameter is missing in the source parameter.

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

30 Jan 2015

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

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests