hejke

IExplorer problem with clicking button

11 posts in this topic

#1 ·  Posted (edited)

Hello again. This time I can't click on a button. I've tried a few examples that I took from the forum, but none of them worked.

 

Here's the HTML?:

$.each(data.busca, function(i,datos){ 
                var tbRow = '<tr class="terminal_row">'+
                    '<td><input type="button" size="5" class="atras" onclick="document.location=\'/'+lang+'/terminals_ng/edit/'+datos.id+'/'+datos.idPlatform+'\'" value="edit"/></td>'+
                    '<td>'+datos.name+'</td>'+
                    '<td>'+datos.identifier+'</td>'+
                    '<td>'+datos.mac+'</td>'+
                    '<td>'+datos.platform+'</td>'+
                    '</tr>';
                $(tbRow).appendTo('#tabla_de_terminales');  
                $("#tabla_de_terminales tr:even").addClass("even");

 

Pic of the button (edit):

Buttton.PNG

 

My code:

$oButtons = _IETagNameAllGetCollection($oIE, "input")
For $oButton in $oButtons
ConsoleWrite($oButton.innerText & @CRLF)
Next

 

But it doesn't work. I have only this error, but I don't know if it's related (I didn't use _IEAttach in any part of the code),

--> IE.au3 T3.0-2 Warning from function _IEAttach, $_IESTATUS_NoMatch

 

Thank you!

Edited by hejke
Add error

Share this post


Link to post
Share on other sites



#2 ·  Posted

Sorry, but that doesn't make sense. How did you establish the value of $oIE? This is normally done via _IEAttach or _IECreate.

Also, that looks like Javascript with some embedded HTML.

Share this post


Link to post
Share on other sites

#3 ·  Posted

15 hours ago, Danp2 said:

Sorry, but that doesn't make sense. How did you establish the value of $oIE? This is normally done via _IEAttach or _IECreate.

Also, that looks like Javascript with some embedded HTML.

The code I posted is not the complete one, I just posted the part with the problem. I used $oIE = _IECreate. 

Yes, I think is Javascript, but I have no knowledge os Javascript whatsoever, so I need help with this.

Share this post


Link to post
Share on other sites

#4 ·  Posted

First things first. You will need to figure out which command is failing with the $_IESTATUS_NoMatch.

Share this post


Link to post
Share on other sites

#5 ·  Posted

Post a larger portion of the html. One or 2 levels up!

Share this post


Link to post
Share on other sites

#6 ·  Posted

Resolved the problem with $_IESTATUS_NoMatch. It was a mistake I made with the code.

 

Here's the complete javascript code:

<script type="text/javascript"> 
 
var lang = "es";
 
function display_product_terminals(value){
    var idbrk=value.split("-"); 
    var url = "/"+lang+"/operaciones_terminals/get_terminals_by_product/"+idbrk[0]+"/"+idbrk[1];
    $.getJSON(url,function(data){
        if(!(data.busca)){
            $.each(data.errores, function(i,datos){
                var tbRow = '<tr class="terminal_row">'+
                '<td colspan="5"><br><div class="error">'+datos.error+'</div><br></td>'+
                '</tr>';
                $(tbRow).appendTo('#tabla_de_terminales');     
                $('#nombre_terminal').append('<option value="" style="color:red;font-weight:bold;">'+datos.error+'</option>'); 
 
            });
 
        }else{          
            $.each(data.busca, function(i,datos){ 
                var tbRow = '<tr class="terminal_row">'+
                    '<td><input type="button" size="5" class="atras" onclick="document.location=\'/'+lang+'/terminals_ng/edit/'+datos.id+'/'+datos.idPlatform+'\'" value="edit"/></td>'+
                    '<td>'+datos.name+'</td>'+
                    '<td>'+datos.identifier+'</td>'+
                    '<td>'+datos.mac+'</td>'+
                    '<td>'+datos.platform+'</td>'+
                    '</tr>';
    
                $(tbRow).appendTo('#tabla_de_terminales'); 
     
                $("#tabla_de_terminales tr:even").addClass("even"); 
            });
        }    
    });     
    $("#tabla_de_terminales").css("display","block");   
}
 
function buscaTerminales(terminal_for_search){
    $('.terminal_row').remove();
    var url = "/"+lang+"/operaciones_terminals/busca_terminal_for_edit/"+terminal_for_search;
    $.getJSON(url,function(data){
        if(!(data.busca)){
            $.each(data.errores, function(i,datos){
                var tbRow = '<tr class="terminal_row">'+
                '<td colspan="5"><br><div class="error">'+datos.error+'</div><br></td>'+
                '</tr>';
                $(tbRow).appendTo('#tabla_de_terminales');     
                $('#nombre_terminal').append('<option value="" style="color:red;font-weight:bold;">'+datos.error+'</option>'); 
 
            });
 
        }else{      
            $.each(data.busca, function(i,datos){ 
                var tbRow = '<tr class="terminal_row">'+
                    '<td><input type="button" size="5" class="atras" onclick="document.location=\'/'+lang+'/terminals_ng/edit/'+datos.id+'/'+datos.idPlatform+'\'" value="edit"/></td>'+
                    '<td>'+datos.name+'</td>'+
                    '<td>'+datos.identifier+'</td>'+
                    '<td>'+datos.mac+'</td>'+
                    '<td>'+datos.platform+'</td>'+
                    '</tr>';
                $(tbRow).appendTo('#tabla_de_terminales');  
                $("#tabla_de_terminales tr:even").addClass("even"); 
            });
        }
    });     
    $("#tabla_de_terminales").css("display","block");   
}

 

Thank you!

Share this post


Link to post
Share on other sites

#7 ·  Posted

Something like the follow may work --

#include <IE.au3>

Local $oIE = _IEAttach("","instance")

Local $oTable = _IEGetObjById('tabla_de_terminales')

Local $oButtons = _IETagNameGetCollection($oTable, 'button')

For $oButton In $oButtons
    _IEAction($oButton, 'click')
Next

Note that I said 'may' because you haven't shown us the final HTML, so I'm only interpreting the JS code and may not have done so correctly. ;-)

Share this post


Link to post
Share on other sites
On 6/1/2017 at 4:22 PM, Danp2 said:

Something like the follow may work --

#include <IE.au3>

Local $oIE = _IEAttach("","instance")

Local $oTable = _IEGetObjById('tabla_de_terminales')

Local $oButtons = _IETagNameGetCollection($oTable, 'button')

For $oButton In $oButtons
    _IEAction($oButton, 'click')
Next

Note that I said 'may' because you haven't shown us the final HTML, so I'm only interpreting the JS code and may not have done so correctly. ;-)

Didn't work either :(

Share this post


Link to post
Share on other sites
1 hour ago, hejke said:

Didn't work either :(

You'll need to be more specific if you want further assistance. Where did it fail? Post the results from the Scite output window.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

It worked in the end. I just had to use another name for _IEAttach.

This is what worked:

 

$oIEA = _IEAttach("","instance")
$oTable = _IEGetObjById($oIEA, 'tabla_de_terminales')
$oButtons = _IETagNameGetCollection($oTable, 'button')
For $oButton In $oButtons
    _IEAction($oButton, 'click')
Next

 

Thank you!

Edited by hejke

Share this post


Link to post
Share on other sites

#11 ·  Posted

You're welcome. I just noticed that I left out the $oIE in the call to _IEGetObjById. Hope that did create confusion for you. ;-)

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