Hello everyone 
I'm a little bit annoyed right now cause I thoughts my dev was simple but not the case for me..
In my form, I'm asking to user to fill a multiple choice (SoftwareName) which is a lookup with data from an other department and save into SP column named "sof3".
ok, working.
BUT, if the user don't find any software into this existing list, he has to fill a free common field text's type.. and wanna these info to be saved ALSO on "sof3".
TESTS:
- if user select info with lookup field, save info in "sof3", WORKS
- if user enter text in common field ignoring to fill lookup field (normal), don't work..
Any idea about what can I set in javascript to solve this pls ?
thanks a lot,
1 Like
Hello @IliaLazarevskii ,
Thanks for the reply but don't work for me cause :
- the lookup list is maintained by an other department, well structured, and I don't want user to add new "messy" entries on this list
- also won't be able to clean data on this listtoo, as explained, it's not my department and also I don't have rights
thanks for your feedback and ideas !
Dear @lolopixxx,
The easiest option is to probably add some radio/checkbox to ask user if they didn't find the item in the list, and then display text field. This would initially hide the text field and only show it once nothing is found.
BTW, Common fields don't save items to SharePoint lists, it might be better to use Single Line text column instead.
@Nikita_Kurguzov ! 
My bad "sof3" is totally a SP single line of text! so, my lookup column is save to "sof3".
But don't know why when I enter something into "sof3" without filling lookup column then nothing is filled 
I even tried to put this :
fd.spRendered(function(){
if (!fd.field('SoftwareName').value) { // if lookup is null then
fd.field('sof3').value = fd.field('_x0073_of3').value; // copy value
}
});
not working too..
Dear @lolopixxx,
The code that you have here is not dynamic, it only runs once when the form loads - what do you need to achieve here? And what's the difference between sof3 and _x0073_of3 fields?
Hello @Nikita_Kurguzov !
My bad, "sof3" is the text title of "_x0073_of3" SP field id... it's so litterally the same thing here.
When the user does not find anything in the SoftwareName list (which is a lookup) then he can write text in "_x0073_of3" (referred to as previously "sof3").
This last text must be saved in the SP column "sof3" IF lookup field is null.
hum.. what about this code ?
fd.spRendered(() => {
//SoftwareName
fd.field('_x0073_of3').$on('change', (value) => {
fd.field('SoftwareName').value = value;
});
fd.field('SoftwareName').$on('change', (value) => {
fd.field('_x0073_of3').value = value;
});
Did I clearly explain this time ? no offence, just feel free to tell me pls.
thanks A LOT
Dear @lolopixxx,
One issue with this logic is that you can't save text value into the Lookup field, and another issue is that the lookup value is not just text, but an object.
Also, is SoftwareName a SharePoint Lookup column or a Lookup control? If it's a column, something like this should work:
fd.spRendered(() => {
fd.field('SoftwareName').$on('change', (value) => {
if (value.LookupValue) {
fd.field('_x0073_of3').value = value.LookupValue;
}
else {
fd.field('_x0073_of3').value = '';
}
});
});
Hello @Nikita_Kurguzov ,
SoftwareName is a Lookup control. So, tried your code, but as expected, not worked.
Thus, am I forced to create another SP column to collect the result of '_x0073_of3' ?
thanks again
1 Like
Dear @lolopixxx,
If you're using Lookup control, just change it a little:
fd.spRendered(() => {
fd.control('SoftwareName').$on('change', (value) => {
if (value.LookupValue) {
fd.field('_x0073_of3').value = value.LookupValue;
}
else {
fd.field('_x0073_of3').value = '';
}
});
});
Hello @Nikita_Kurguzov ,
Thanks for helping me, but still not working.
I made the change (copy paste your new code shared) then made 2 tests :
- first with multiple choice lookup, ok worked
- second with "sof3" filled, lookup control empty - not worked
Dear @lolopixxx,
What exactly did not work? It's hard to say from these screenshots alone:
- first with multiple choice lookup, ok worked
So, the copying works?
- second with "sof3" filled, lookup control empty - not worked
What's the expected behavior here? If you just want to keep the entered value, maybe the following adjustments is all you need?
fd.spRendered(() => {
fd.control('SoftwareName').$on('change', (value) => {
if (value.LookupValue) {
fd.field('_x0073_of3').value = value.LookupValue;
}
});
});