0
I have that function:
function AbreGrupoCarencia(pTitulo, pTipo, pLinha, pCodigo, pCodTsContrato, pCodEntidadeTS, pNomeEntidade, pProtocoloAtendimento, pCodContratoAmpliado)
{
var txt_codigo = eval('document.form01.' + pCodigo + '.value');
//alert(txt_codigo);
if ( txt_codigo != '' ){
if ( parseInt(txt_codigo) <=0)
alert('Código inválido');
}
if ( txt_codigo == '' ){
alert('Código não informado');
return false;
}
var sAction = '../../cmp/asp/cmp0102a.asp';
sAction = sAction + '?cod_pesquisa=' + txt_codigo;
sAction = sAction + '&ind_tipo=' + pTipo;
sAction = sAction + '&cod_ts_contrato=' + pCodTsContrato;
sAction = sAction + '&cod_entidade_ts=' + pCodEntidadeTS;
sAction = sAction + '&nome_entidade=' + pNomeEntidade;
sAction = sAction + '&txt_protocolo_atendimento=' + pProtocoloAtendimento;
sAction = sAction + '&cod_contrato_ampliado=' + pCodContratoAmpliado;
sAction = sAction + '&PT=' + pTitulo;
AbrePesquisaCrossBrowser(sAction, pTitulo, pTitulo, 1000, 800, 50, 50, 'S');
}
What’s going on. Well, the alert
commented at the beginning of the function, IE
me brings back 10(in a situation) and in Chrome
, obeying the same criteria, brings me undefined
. The error is in that line: var txt_codigo = eval('document.form01.' + pCodigo + '.value');
. Scanning the code, I noticed that IE accepts getElementByID() even if there is no ID, only Name, but Chrome does not. If it is ID it has to have ID(correct). Well, in the scan, I put ID for all elements that have only Name. This solved some problems, but I continue, in this file, not working. It should display a window(popup) and nothing happens.
And why the
eval
? You cannot read the direct element value ?– DontVoteMeDown
So the site is huge and we’re not here to do that kind of thing. If Val is the problem of not working, then we intervene, but our function is to make the site on Chrome. It’s a very big site and our limit is there. Because what’s on Eval(), man, is awesome, but if it’s working we don’t intervene. That’s why he’s there. If he’s the reason it doesn’t work, which I don’t know, then we intervene. We just customize it for Chrome. We discovered many mistakes, but we can not intervene. This generates cost, well you know how it is third, Anything, has to have approval from above.
– pnet
Let me get this straight, you can’t change the scripts on the site, that’s it ?
– DontVoteMeDown
@Not dontvotemedown, it wasn’t that. We can. What I said is that the site is very large. It has infinity Eval(), and let’s not stick to that. Our function here is to make the module in question work on Chrome. If Eval() is such a problem, we intervene, alter and etc. If not, we leave aside and stick to our function only. We are not fixing the site, just a module to work on Chrome, because it does not run on Chrome given to several errors. We were called to this only.
– pnet
@Dontvotemedown for example. You quoted Eval() in function. If it is the problem we intervene, if it is not the problem, we leave aside and we will see what is happening that does not work, later on. In that case, it may be the problem, I posted to ask the opinion of colleagues on.
– pnet
I asked from Val to try to find out if the mistake is in himself, since even you said that the error is in his line, and of course if you have wrong you have to move, if not, no.
– DontVoteMeDown
Although Eval is totally unnecessary I don’t think it’s the cause of the problem. You’ve already checked the value of
pCodigo
is correct? Because testing here in Chrome, IE and Firefox in all this way to access the value of a field worked.– Leandro Godoy Rosa
@Leandrogodoyrosa also think. But the AP is kind of ignorant in the comments so it is difficult to help.
– DontVoteMeDown
@Dontvotemedown, did not understand the ignorant AP in the comments. What was it that I said too much there? Really did not understand. I made three comments trying to expose my situation and it gives as much subsidy as possible, and I didn’t see where I wrote anything rude to anyone here. I did not understand your comment. Here should have only comment related to the core of the issue. These things were supposed to be at META, but I wasn’t at any rude moment. Can you show me which line? If there’s been a misconception, I’ll correct it, but read my comments and see if Down’s carburettor.
– pnet
@pnet didn’t mean rude, but it didn’t help much in his comments, that’s all. I was going to say the same thing about Diego but you kept saying a lot of things. Anyway,.
– DontVoteMeDown
I don’t think I stopped you from saying anything about Diego, but his answer solved my problem. I’ll stick to the heart of the problem. Javascript. That kind of comment, for me, ends here.
– pnet