Lookup with free form text.

Discussions about Cross-site Lookup
Locked
ds4be
Posts: 20
Joined: Fri Nov 07, 2014

22 Mar 2016

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.

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

23 Mar 2016

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".

ds4be
Posts: 20
Joined: Fri Nov 07, 2014

23 Mar 2016

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?

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

23 Mar 2016

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

ds4be
Posts: 20
Joined: Fri Nov 07, 2014

23 Mar 2016

Thanks.

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

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

23 Mar 2016

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.

ds4be
Posts: 20
Joined: Fri Nov 07, 2014

23 Mar 2016

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.

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

23 Mar 2016

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();

ds4be
Posts: 20
Joined: Fri Nov 07, 2014

24 Mar 2016

Thanks!

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests