1

I am using SharePoint 2013 online and I have created a form for my list using Infopath 2013. It has a combination of text fields and dropdowns.

I am able to set the default value of text field using like

$('input[originalid="V1_I1_T6"]').val('hello');

but not the dropdown like

$('select[originalid="V1_I1_D16"]').val('45');

What am I missing?

enter image description here

2
  • What is this originalid="V1_I1_D16" Jun 10, 2015 at 16:00
  • It is one of the attributes
    – Keerthi
    Jun 10, 2015 at 16:42

3 Answers 3

0

Check this.Make sure Jquery is referenced

$('select[originalid=V1_I1_T6]').val("45");

Check this fiddler link also which I created. https://jsfiddle.net/tL5k6w22/

2
  • 1
    Please update your first answer instead of posting multiple very similar answers! Jun 10, 2015 at 18:50
  • I knows its working in the jsfiddle. But it does not work with form build in Infopath.
    – Keerthi
    Jun 10, 2015 at 19:30
0

make sure to call focus before setting value,

$('select[id=V1_I1_T6]').focus();

$('select[id=V1_I1_T6]').val('hello');
0

The complete jquery code is :

DropDownList.SetValueOfControl($('#ctl00_ctl45_g_aa5a291c_b931_4c0f_b477_f57a9cf522f2_FormControl0_V1_I1_D2')[0],lookupVal );


$("select[originalid='V1_I1_D2']").val(lookupVal).change();
1
  • I have a strong belief there is a possibility that this code won't compile :) Apr 19, 2016 at 8:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.