Getting Display form vs Edit Form data
Posted: 28 Apr 2014
I'm having a small issue getting data from the display form. The data is in a standard dropdown.
Here I get the data from the edit form if this form was opened from the edit form. This works because setting the varText will only work if the form was opened from the edit form.
varText = $('.ms-dlgFrame', window.top.document)[0].contentWindow.fd.field('Title').value();
varRelationID = $('.ms-dlgFrame', window.top.document)[0].contentWindow.fd.field('Potential_x0020_Client').value();
varRelationText = $('.ms-dlgFrame', window.top.document)[0].contentWindow.fd.field('Potential_x0020_Client').control('getSelectedText');
If varText fails I assume the form was opened from the display so I try to get the same data from the display form:
varText = $('.ms-dlgFrame', window.top.document)[0].contentWindow.fd.field('Title').control()._el().text();
varRelationID = $('.ms-dlgFrame', window.top.document)[0].contentWindow.fd.field('Potential_x0020_Client').control()._el().value();
varRelationText = $('.ms-dlgFrame', window.top.document)[0].contentWindow.fd.field('Potential_x0020_Client').control._el().text();
From the edit form is no problem. I just can't seem to get the ID and Text of the dropdown on the calling display form. I need both as I'll be setting the value of a cross site lookup.
Thank you!!!
Here I get the data from the edit form if this form was opened from the edit form. This works because setting the varText will only work if the form was opened from the edit form.
varText = $('.ms-dlgFrame', window.top.document)[0].contentWindow.fd.field('Title').value();
varRelationID = $('.ms-dlgFrame', window.top.document)[0].contentWindow.fd.field('Potential_x0020_Client').value();
varRelationText = $('.ms-dlgFrame', window.top.document)[0].contentWindow.fd.field('Potential_x0020_Client').control('getSelectedText');
If varText fails I assume the form was opened from the display so I try to get the same data from the display form:
varText = $('.ms-dlgFrame', window.top.document)[0].contentWindow.fd.field('Title').control()._el().text();
varRelationID = $('.ms-dlgFrame', window.top.document)[0].contentWindow.fd.field('Potential_x0020_Client').control()._el().value();
varRelationText = $('.ms-dlgFrame', window.top.document)[0].contentWindow.fd.field('Potential_x0020_Client').control._el().text();
From the edit form is no problem. I just can't seem to get the ID and Text of the dropdown on the calling display form. I need both as I'll be setting the value of a cross site lookup.
Thank you!!!