jquery - Programmatically select value in DropDown element with JavaScript in Lightswitch -


I have to select one of the options from the drop-down element ("type" in the picture) when my LSML form loads is .

When the form loads, I need to see that "2-intermediate-type" values ​​were already selected in this element.

This is a form that connects a new entity to the database.

The solution I tried was to write some java script code in this drop-down element in the postRender event.

Like this:

  myapp.AddBeneficiary.Beneficiary_TIP_postRender = Function (element, content item) {$ (contentItem) .text ("2-intermediate-type"); Element.textContent = "2-Intermediate-type"; $ (Element) = "2-intermediate-type"; $ (Element). Option ["2-Intermediate-type"]. Selected = true; }  

None of the above four types work for me

I am beginning with both MS Illumination and Javascript, so I'm not sure whether it is difficult or easy task in this context.

But I am surprised that this does not work so easily because on other programming languages ​​/ platforms this work is trivial.

Thanks for any help!

The problem is with the architecture of LightSchurch and SharePoint

by selecting an option Instead, you are not actually priced or selected, instead you are changing the text of .ui-btn-text. Here's what I have:

if (screen.Customers.selectedItem.countryDrop! = Null) {$ ("# filterRecentByCountry"). Parent (). Find (".ui-btn-text") .find ("time") text (screen.Customers.selectedItem.countryDrop); }

I have a custom dropdown list, so I use the ID but this principle is similar to the original dropdown. I really hope this helps.


Comments