window.open not executed with '_self' option !!!

Hi,

First of all, I would like to wish a happy new year 2016 to all.

I try to integrate barcode reading on javascript in a multiple rows form app calling a blank app for mysql update, this my code :

in onScriptInit

[v_strecho]="BarCode/Ref.: <input type=‘text’ id=‘barCode’ autofocus ><button>Add</button>

<table border=‘1’ id=‘list’ width=‘100%’>
<tr>
<th>Bar Code</th>
<th>Qty</th>
</tr>
</table>

<script type=‘text/javascript’>
$(function(){
$(‘button’).click(function(){
if($(’#barCode’).val()){
var barCode = $(’#barCode’).val();
//alert(barCode);

        window.open('../blank_tmpposjou/blank_tmpposjou.php?v_libart='+barCode,'_self');

        if($('#list td:eq(0):contains('+barCode+')').length){
            $('#list td:eq(0):contains('+barCode+')').next().text(function(index, text){
            return parseInt(text) + 1;
            });
        } else {
            $('#list').append('&lt;tr&gt;&lt;td&gt;'+barCode+'&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;/tr&gt;');
            

        }

         $('#barCode').val('');

    }
});

});
</script>";

in footer col1

value => [v_strecho]

My problem is that “blank_tmpposjou” is not executed because of ‘_self’ option ?? If I change only ‘_self’ with ‘_blank’ it execute blank_tmpposjou but it opens a new tab on browser and I don’t want it.

Any help will be appreciated
Thanks
Nac

Any idea ???

Hello Nancyil, I hope your new year is doing good.

So, firstly, run your app, open the inspection tool and note if any JavaScript error is occurring.
I gave a fast look into your code around ‘_self’ area and it seems a typo.

This:


window.open('../blank_tmpposjou/blank_tmpposjou.php?v_libart='+barCode,'_self');

Should be this:


window.open('../blank_tmpposjou/blank_tmpposjou.php?v_libart='+barCode'[B],[/B]_self');

If it’s not the case, report back with your JS error, if it happens, or with a detailed information of the expected result and the actual result.

Hi Cavadinha

There is no error because if I change ‘_self’ by ‘_blank’ in my code everything works but it opens an another window on browser

If I put this code in a blank app in place of a form it works

Thanks
Nac