Jump to content

IExplorer problem with clicking button


hejke
 Share

Recommended Posts

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

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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. ;-)

Link to comment
Share on other sites

  • 3 weeks later...
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 :(

Link to comment
Share on other sites

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
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...