0

I have a selectlist:

<select style="ime-mode: auto; background-color: rgb(255, 255, 255);" id="il_worksheettype" class="ms-crm-SelectBox" tabIndex="1100" name="il_worksheettype" attrPriv="7" attrName="il_worksheettype" req="2" defaultSelected="null">
<option title="" selected="selected" value=""></option>
<option title="Underwriting" value="102790001">Underwriting</option>
<option title="Claim" value="102790000">Claim</option></select>

and I have the code:

worksheetTypes.Option("Claim").Select();
ProtectionInfoTab.Frame(Find.ById("contentIFrame")).Eval("$('#il_worksheettype').change();");

The problem is that for some reason it just wont run the javascript or at least this is the impression I'm getting. When this code there are no exceptions thrown but it just does not seem to do anything when it should be making options on another selectlist appear.

any ideas?

Ben
  • 2,518
  • 4
  • 18
  • 31

3 Answers3

1

Use RunScript instead of Eval. Eval seems to bind the change, but do not trigger the change.

RunScript worked for me, where pk is the element reference.

Element pk = BrowserInstance.TextField("password");    
pk.DomContainer.RunScript("$('#" + pk.Id + "').change();");    
Nic
  • 12,220
  • 20
  • 77
  • 105
Abhay
  • 36
  • 1
0

In your Eval statement, your change function is used to bind an event rather than to trigger one. To trigger an event use the following:

$('#il_worksheettype').trigger('change');

http://api.jquery.com/change/

0

You can use below code for IE to trigger change event after selecting an option from select list.

browserInstance.RunScript("$('#il_worksheettype').change()");

For firefox

browserInstance.RunScript("window.$('#il_worksheettype').change()");
Sham
  • 830
  • 9
  • 27