Sign in to follow this  
Followers 0
hugmax

How to refresh option select

4 posts in this topic

<div class="row marg-b-20">
                                        <div class="col-lg-6">
                                            <div class="control-group">
                                                <label class="control-label" for="marca-terminal">Marca del terminal :</label>
                                                <div class="controls">
                                                    <div class="custom-dropdown-select-parent-0 form-control simlockSelect custom-dropdown-select custom-dropdown-select-0 custom-dropdown-select"><span>Selecciona marca</span><select name="brand" class="form-control simlockSelect custom-dropdown-select custom-dropdown-select-0" id="form_simlock_brand" data-custom-dropdown-select="0" data-dropdown-label="Selecciona marca">
                                                        <option value="">Selecciona marca</option>
<option value="ALCATEL">ALCATEL</option><option value="APPLE">APPLE</option><option value="ASUS">ASUS</option><option value="BENQ - SIEMENS">BENQ - SIEMENS</option><option value="BLACKBERRY">BLACKBERRY</option><option value="BPA">BPA</option><option value="BQ">BQ</option><option value="DORO">DORO</option><option value="HP">HP</option><option value="HTC">HTC</option><option value="HUAWEI">HUAWEI</option><option value="JABLOCOM">JABLOCOM</option><option value="KAZAM">KAZAM</option><option value="LENOVO">LENOVO</option><option value="LG">LG</option><option value="MITSUBISHI">MITSUBISHI</option><option value="MOTOROLA">MOTOROLA</option><option value="NEC">NEC</option><option value="NOKIA">NOKIA</option><option value="ORANGE">ORANGE</option><option value="PANASONIC">PANASONIC</option><option value="PHILIPS">PHILIPS</option><option value="SAGEM">SAGEM</option><option value="SAMSUNG">SAMSUNG</option><option value="SONY">SONY</option><option value="SONY ERICSSON">SONY ERICSSON</option><option value="SPC">SPC</option><option value="TOSHIBA">TOSHIBA</option><option value="XACOM">XACOM</option><option value="ZTE">ZTE</option>                                                    </select><i class="fa fa-caret-down"></i></div>
                                                    <p class="help-block error">Por favor, selecciona una marca.</p>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-lg-6">
                                            <div class="control-group">
                                                <label class="control-label" for="modelo-terminal">Modelo del terminal :</label>
                                                <div class="controls">
                                                    <div class="custom-dropdown-select-parent-1 form-control simlockSelect custom-dropdown-select custom-dropdown-select-1 custom-dropdown-select disabled"><span>Selecciona primero marca</span><select name="model" class="form-control simlockSelect custom-dropdown-select custom-dropdown-select-1" id="form_simlock_model" disabled="disabled" data-custom-dropdown-select="1" data-dropdown-label="Selecciona primero marca">
                                                        <option>Selecciona primero marca</option>
                                                    </select><i class="fa fa-caret-down"></i></div>
                                                    <p class="help-block error">Por favor, selecciona una modelo.</p>
                                                </div>
                                            </div>
                                        </div>
                                    </div>

I am using this code:

;_IEFormElementOptionSelect($oSelectMarca, "ALCATEL", 1, "byText")
    sleep(1000)
    _IEFormElementOptionSelect($oSelectMarca, 4, 1, "byIndex")
      ConsoleWrite("Malor de select " & $oSelectMarca.value & @CRLF )
    _IEAction($oInputImei, "focus")
     _IEAction($oInputImei, "selectall")
    sleep(1000)

    Local $oSelectModel = _IEFormElementGetObjByName($oForm, "model")
    _IEAction($oSelectModel, "focus")


    ;_IEFormElementOptionSelect($oSelectMarca, "ALCATEL", 1, "byText")
    sleep(1000)
    _IEFormElementOptionSelect($oSelectModel, 4, 1, "byIndex")
      ConsoleWrite("Valor de modelo " & $oSelectModel.value & @CRLF )
    Local $oCheck = _IEFormElementGetObjByName($oForm, "check")
    _IEAction($oCheck, "focus")

  _IEFormElementCheckBoxSelect($oForm, 0, "", 1, "byIndex")
  _IEFormElementCheckBoxSelect($oForm, 1, "", 1, "byIndex")

But the second option does not activate until there is a click on the first one (Brand)

 

Share this post


Link to post
Share on other sites



There is probably a Javascript event tied to the first element that needs to be triggered so that the second element is loaded with the correct values.

Share this post


Link to post
Share on other sites
Local $oSelectMarca = _IEFormElementGetObjByName($oForm, "brand")
    _IEAction($oSelectMarca, "focus")
    ;_IEFormElementOptionSelect($oSelectMarca, "ALCATEL", 1, "byText")
    sleep(1000)
    _IEFormElementOptionSelect($oSelectMarca, 4, 1, "byIndex")
      ConsoleWrite("Malor de select " & $oSelectMarca.value & @CRLF )
    _IEAction($oInputImei, "focus")
     _IEAction($oInputImei, "selectall")
    sleep(1000)
   $oSelectMarca.fireEvent("change")

I tried using fireevent on select. but

Malor de select BENQ - SIEMENS
"C:\Users\hugmax\Desktop\orange.au3" (65) : ==> The requested action with this object has failed.:
$oSelectMarca.fireEvent("change")
$oSelectMarca^ ERROR
>Exit code: 1    Time: 14.28

I cannot find a fireevent on the help file.

Share this post


Link to post
Share on other sites

Hard to give you any further advise without knowing the underlying technology being used. You may want to review this thread where we triggered the jQuery change event.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0