How to reference Cross-Site Lookup field
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
We are working on JS-framework and soon you will be able to use all of these methods. But currently you can just get or set id with value() method and handle 'change' event with change() method.
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
We have updated our article with additional samples of working with Cross-site Lookup via JavaScript:
http://spform.com/forms-designer- ... eld-values
http://spform.com/forms-designer- ... eld-values
Can you tell me what I am doing wrong?
Here is my code:
function buildTitle(){
var nam = fd.field('Personnel').control('data')['Title'];
var bd = new Date(fd.field('Begin_x0020_Date').control().value());
var ed = new Date(fd.field('End_x0020_Date').control().value());
bdd = bd.getDate();
bmm = bd.getMonth() + 1;
byy = bd.getFullYear();
edd = ed.getDate();
emm = ed.getMonth() + 1;
eyy = ed.getFullYear();
fd.field('Title').control().value(name + ' [' + bmm + '/' + bdd + '/' + byy + ' - ' + emm + '/' + edd + '/' + eyy + ']');
}
fd.field('Personnel').control().change(function(){
buildTitle();
});
fd.field('Begin_x0020_Date').control().change(function(){
buildTitle();
});
fd.field('End_x0020_Date').control().change(function(){
buildTitle();
});
The output I get from the function doesn't include the Personnel name.
Here is my code:
function buildTitle(){
var nam = fd.field('Personnel').control('data')['Title'];
var bd = new Date(fd.field('Begin_x0020_Date').control().value());
var ed = new Date(fd.field('End_x0020_Date').control().value());
bdd = bd.getDate();
bmm = bd.getMonth() + 1;
byy = bd.getFullYear();
edd = ed.getDate();
emm = ed.getMonth() + 1;
eyy = ed.getFullYear();
fd.field('Title').control().value(name + ' [' + bmm + '/' + bdd + '/' + byy + ' - ' + emm + '/' + edd + '/' + eyy + ']');
}
fd.field('Personnel').control().change(function(){
buildTitle();
});
fd.field('Begin_x0020_Date').control().change(function(){
buildTitle();
});
fd.field('End_x0020_Date').control().change(function(){
buildTitle();
});
The output I get from the function doesn't include the Personnel name.
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hello,
You have to use the internal name of the field from the linked list instead of 'Title'. In you case the internal name is 'Full_x0020_Name'. So, try the following code:
You have to use the internal name of the field from the linked list instead of 'Title'. In you case the internal name is 'Full_x0020_Name'. So, try the following code:
Code: Select all
fd.field('Personnel').control('data')['Full_x0020_Name']
-
- Information
-
Who is online
Users browsing this forum: No registered users and 26 guests