Page 1 of 1

Lookup with free form text.

Posted: 22 Mar 2016
by ds4be
Hi
Can you advise if the following is possible.

I have a lookup column that links to a table with several statements, I would like the user to be able to select one or more of the statements, however I would like them to be able to add free form text?

I was hoping that a button with code can be used to Add the statements to a multitext field and then reset the lookup field at the same time or on closure of the form.

Re: Lookup with free form text.

Posted: 23 Mar 2016
by rostislav
Hi,

You can use the 'Add new item' button option. Please check this page: http://spform.com/lookup

The option is available if you go to "Manage Plumsail Lookups" -> tick "Add 'New Item' link".

Re: Lookup with free form text.

Posted: 23 Mar 2016
by ds4be
I would prefer it if they were not allowe to add to the lookup list as this will become an uncontrolled list quickly.

Is there a way of selecting the data in the lookup (multiple values) and copying it to a multiline text field?

Re: Lookup with free form text.

Posted: 23 Mar 2016
by rostislav
Sorry, it seems I didn't get your request at first. You want to copy the value of a CSL field into a text field via a button click it seems. For that:
1. Add a button to the form
2. Use its onclick attribute to add code
3. See here what code you need to add exactly: http://spform.com/forms-designer- ... eld-values

Re: Lookup with free form text.

Posted: 23 Mar 2016
by ds4be
Thanks.

Is it possible to remove all the items selected in the look up field?

Re: Lookup with free form text.

Posted: 23 Mar 2016
by rostislav
Remove from where? If you want to clear the CSL field, you can simply set the value of it to an empty array:

Code: Select all

fd.field('CrossSiteLookup').value([]) 
If you want to remove them from the multiline text field you were talking about, you'll have to get the value of the field, parse it somehow (depending on how you were adding those values in the first place) into an array, remove the appropriate entries, parse back into a string and set the field.

Re: Lookup with free form text.

Posted: 23 Mar 2016
by ds4be
Hi

Yes I want to set the native sharepoint lookup field to null / remove all selections.

I tried the supplied code however it does not remove all the items.

Re: Lookup with free form text.

Posted: 23 Mar 2016
by rostislav
Try this ('lkp' is an example internal name)

Code: Select all

fd.field('lkp').control()._el().find('select:eq(1) option').prop('selected', true);
fd.field('lkp').control()._el().find('button:eq(1)').click();

Re: Lookup with free form text.

Posted: 24 Mar 2016
by ds4be
Thanks!