pre populating a related items field
I have a list with a column that generates a unique number with the help of a workflow. I have this column as a look up in my "main" list.
In my main edit form i have a related items section at the bottom. When i click on new item from the related items section, the form that pops up displays the unique number field as a drop down (showing all records created). I wish to populate this field with the unique reference number of the task im editing, not to have to choose from a dropdown.
I hope all this make sense
In my main edit form i have a related items section at the bottom. When i click on new item from the related items section, the form that pops up displays the unique number field as a drop down (showing all records created). I wish to populate this field with the unique reference number of the task im editing, not to have to choose from a dropdown.
I hope all this make sense
looking at the "view source" from the related items form, the column in question shows;
<option selected="selected" value="0">(None)</option>
<option value="126">H0000</option>
<option value="76">H0033</option>
<option value="77">H0034</option>
<option value="78">H0005</option>.........and the list goes on stating all the records that have been added
<option selected="selected" value="0">(None)</option>
<option value="126">H0000</option>
<option value="76">H0033</option>
<option value="77">H0034</option>
<option value="78">H0005</option>.........and the list goes on stating all the records that have been added
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
You can retrieve a parent's field from the child form via JavaScript:
Then you just need to assign the retrieved value to the appropriate child's field:
Code: Select all
window.top.fd.field('FieldName').value()
Code: Select all
fd.field('FieldName').value(val);
Thanks for getting back so quickly Dmitry,
apologies for my ignorance im new to SPForms, the lookup field i want to pre populate in my related items new form is called TAFNo.
Do i put the following code in the main javascript (toolbar) or when the field is highlighted in the JS from the control section.
window.top.fd.field('TAFNo').value()
fd.field('TAFNo').value(val);
apologies for my ignorance im new to SPForms, the lookup field i want to pre populate in my related items new form is called TAFNo.
Do i put the following code in the main javascript (toolbar) or when the field is highlighted in the JS from the control section.
window.top.fd.field('TAFNo').value()
fd.field('TAFNo').value(val);
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
If you need to populate a lookup to the parent item, please, read the post:
http://spform.com/office-365/crea ... office-365
http://spform.com/office-365/crea ... office-365
-
- Information
-
Who is online
Users browsing this forum: No registered users and 24 guests