Jump to content

Javascript ComboBox, Setting Value Doesn't Fire "onselected"


Recommended Posts

Still working on a complicated script to automate a file download here.

I can make the "filterName" input box have my value in it, but it doesn't perform the action and there is no button to click to force the action. The loading of the panel is fired by the select listener in the javascript. The combo box is not assigned to a variable, so I can figure out how to fire the combobox.selectbyvalue to make it start.

Any guidance would be appreciated, so close to completing the complicated portion of the script.

This javascript combined with some HTML template creates a menu on a page:

tbar:["WFX Data Export", '->', "Filter Name: ",
                        new Ext.form.ComboBox(
                            {id:'filterName',
                             store:new wfx.Store(),
                             mode:'local',
                             triggerAction:'all',
                             selectonfocus:true,
                             displayField:'filter_name',
                             valueField:'filter_name',
                             listeners:{select:onFilterSelect,
                                            blur:adjustFilterButtons},
                             afterRender: function() {
                                 Ext.form.ComboBox.superclass.afterRender.call(this);
                                 this.el.setStyle('text-transform', 'uppercase');
                                 this.el.set({'maxlength':20});
                             }
                            }),
                        ' ', ' ',
                        {text:'Save', handler:saveFilter,
                         icon:'images/disk.png', cls:'x-btn-text-icon',
                         id:'save-fltr-btn', disabled:true},
                        {text:'Delete', handler:deleteFilter,
                         icon:'images/delete.png', cls:'x-btn-text-icon',
                         id:'del-fltr-btn', disabled:true}
                      ],

This is the HTML created by this:

<DIV style="WIDTH: 741px" id=ext-comp-1088 class="x-toolbar x-small-editor x-toolbar-layout-ct"><TABLE class=x-toolbar-ct cellSpacing=0><TBODY><TR><TD class=x-toolbar-left align=left><TABLE cellSpacing=0><TBODY><TR class=x-toolbar-left-row><TD id=ext-gen117 class=x-toolbar-cell><DIV id=ext-comp-1089 class=xtb-text>WFX Data Export</DIV></TD></TR></TBODY></TABLE></TD><TD class=x-toolbar-right align=right><TABLE class=x-toolbar-right-ct cellSpacing=0><TBODY><TR><TD><TABLE cellSpacing=0><TBODY><TR class=x-toolbar-right-row><TD id=ext-gen119 class=x-toolbar-cell><DIV id=ext-comp-1091 class=xtb-text>Filter Name: </DIV></TD><TD id=ext-gen121 class=x-toolbar-cell><DIV style="WIDTH: 165px" id=ext-gen123 class="x-form-field-wrap x-form-field-trigger-wrap"><INPUT style="TEXT-TRANSFORM: uppercase; WIDTH: 148px" id=filterName class=" x-form-text x-form-field" size=24 name=filterName autocomplete="off" maxlength="20"><IMG id=ext-gen124 class="x-form-trigger x-form-arrow-trigger" src="https://technet.csgsystems.com/chtr/wfx/00405082605/images/default/s.gif"></DIV></TD><TD id=ext-gen125 class=x-toolbar-cell><DIV id=ext-gen126 class=xtb-spacer></DIV></TD><TD id=ext-gen127 class=x-toolbar-cell><DIV id=ext-gen128 class=xtb-spacer></DIV></TD><TD id=ext-gen129 class=x-toolbar-cell><TABLE style="WIDTH: auto" id=save-fltr-btn class="x-btn x-btn-text-icon  x-btn-text-icon x-item-disabled" disabled cellSpacing=0><TBODY class="x-btn-small x-btn-icon-small-left"><TR><TD class=x-btn-tl><I> </I></TD><TD class=x-btn-tc></TD><TD class=x-btn-tr><I> </I></TD></TR><TR><TD class=x-btn-ml><I> </I></TD><TD class=x-btn-mc><EM unselectable="on"><BUTTON style="BACKGROUND-IMAGE: url(images/disk.png)" id=ext-gen130 class=" x-btn-text">Save</BUTTON></EM></TD><TD class=x-btn-mr><I> </I></TD></TR><TR><TD class=x-btn-bl><I> </I></TD><TD class=x-btn-bc></TD><TD class=x-btn-br><I> </I></TD></TR></TBODY></TABLE></TD><TD id=ext-gen131 class=x-toolbar-cell><TABLE style="WIDTH: auto" id=del-fltr-btn class="x-btn x-btn-text-icon  x-btn-text-icon x-item-disabled" disabled cellSpacing=0><TBODY class="x-btn-small x-btn-icon-small-left"><TR><TD class=x-btn-tl><I> </I></TD><TD class=x-btn-tc></TD><TD class=x-btn-tr><I> </I></TD></TR><TR><TD class=x-btn-ml><I> </I></TD><TD class=x-btn-mc><EM unselectable="on"><BUTTON style="BACKGROUND-IMAGE: url(images/delete.png)" id=ext-gen132 class=" x-btn-text">Delete</BUTTON></EM></TD><TD class=x-btn-mr><I> </I></TD></TR><TR><TD class=x-btn-bl><I> </I></TD><TD class=x-btn-bc></TD><TD class=x-btn-br><I> </I></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD><TD><TABLE cellSpacing=0><TBODY><TR class=x-toolbar-extras-row></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV>[/HTML]

Edited by joe1981al
Link to comment
Share on other sites

Very dirty, but it works but doesn't give me any error checking capabilities against list options.

WinActivate("Workforce Express")
    $sendwhile = 27
    While $sendwhile > 0
        Send("{TAB}")
        $sendwhile = $sendwhile -1
        Sleep(500)
    WEnd
    Send($initechfilter & "{ENTER}")
Edited by joe1981al
Link to comment
Share on other sites

It is not clear what is creating what you are calling the ComboBox... there is no SELECT tag in that HTML. Need to be more specific.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

It is not clear what is creating what you are calling the ComboBox... there is no SELECT tag in that HTML. Need to be more specific.

Dale

Attached Capture.JPG is the toolbar created by the javascript above and show in HTML below it. I can _IEFormElementSetValue($orptframe, $techfilter) and the box will populate with "CUITECHS" (my filter variable). My issue is that its not a traditional HTML dropdown box and doesn't use the "onchange" event to perform action. The javascript above is waiting for a select record action to perform "on(select:onFilterSelect)", I know how use function to fire javascript but the issue I'm having is "new Ext.form.ComboBox" is not assigned to a variable so I can call it directly with something like combo.SelectValue("CUITECHS",True).

My work around does function by making IE active window and tabbing to that box then typing in it. Probably more javascript in the background watching that box for input changes, but for some reason setting the value directly doesn't cause the action to fire.

Link to comment
Share on other sites

I see no attachment.

Are you familiar with the fireEvent method? A common way of creating menus with Javascript is attaching actions to elements (typically DIV elements). You can fire the necessary actions by generating events yourself... for example:

$oDiv.fireEvent("onmousedown")

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

I see no attachment.

Are you familiar with the fireEvent method? A common way of creating menus with Javascript is attaching actions to elements (typically DIV elements). You can fire the necessary actions by generating events yourself... for example:

$oDiv.fireEvent("onmousedown")

Dale

Sorry that the attachment didn't post on, its on this one. I forgot to click "attach this file".

post-59191-12800930569984_thumb.jpg

Sorry if it was confusing, but did dig deeper and the combo box items are in a DIV element, just the div was not loaded until I clicked on the down arrow next to the input box. I have now wrote myself a little function to click that image and then find the correct DIV on the page to click on. BTW the "IEMyFullClick" just fires onmousedown, onmouseup, click so no matter what the javascript is watching it will find it.

Func TechCriteria($oIE)
    _IEImgClick($oIE, "https://technet.csgsystems.com/chtr/wfx/00524105036/images/default/s.gif","src",18)
    Sleep(1000)
    $divs = _IETagNameGetCollection($oIE, "div")
    $techfilter = IniRead(".\WFXSettings.ini", "TechFilter", "filter", "NotFound")
    For $div in $divs
        If StringInstr($div.className, "x-combo-list-item") Then
            If $div.innertext = $techfilter Then
                IEMyFullClick($div)
                ExitLoop
            EndIf
        EndIf
    Next
    
EndFunc

I'm somewhat new to scripting, especially on this level. Your suggestions on this and my other post of worked great and searching the forums has helped me tremendously putting things together. Almost everything is done now and just finishing up with some error checks being put in.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...