Page 1 of 1

Add property to single text field

Posted: 21 Sep 2020
by MARIN
Hi,

It is possible to add the "list" property to a single line text field with Javascript?

At the top of the form I added a HTML control containing a datalist. I would like to bind the ID of the datalist to the field. It should allow the user to choose predefined values from the list but not force it.

Re: Add property to single text field

Posted: 22 Sep 2020
by mnikitina
Hello Marin,

I'm not sure I fully understand your case. Could you please provide more details, some screenshots of the form also would be helpful.

Re: Add property to single text field

Posted: 23 Sep 2020
by MARIN
Hi,

I finally found the answer myself.

I added a HTML container containing a <datalist id="mydatalist">....</datalist> element on top of the form.
And then connected the datalist to the SharePoint field

Code: Select all

fd.field('Personal_x0020_titel').control()._el().find('input').attr('list', 'mydatalist')