Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Validation Dynamic Rules, problems.
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Daniel Silver  
View profile  
 More options Nov 9 2009, 1:37 pm
From: Daniel Silver <producaodanielsil...@gmail.com>
Date: Mon, 9 Nov 2009 10:37:52 -0800 (PST)
Local: Mon, Nov 9 2009 1:37 pm
Subject: Validation Dynamic Rules, problems.

Hello,
I am having a problem with YAV , when i call several times
"(yav.ini)" (like to create 3 rows on table dynamic)

This code is OK!, all the Rules are creating correct, but i am having
problems when i call several times yav.init, on third time ,
therefore , the rules are aplied but the mask is wrong position.

Thanks if anyone can help me.

------------- My Code
<html>
<body>
<script type="text/javascript" src="../../../script/js_compact/
yav.js"></script>
<script type="text/javascript" src="../../../script/js_compact/yav-
config-pt-BR.js"></script>
<script>
function addRowToTablePercentagem()
{
  idxUltimaRegra=idxUltimaRegra+10;

  var tbl = document.getElementById('tblPercentagem');
  var lastRow = tbl.rows.length;
  // if there's no header row in the table, then iteration = lastRow +
1
  var iteration = lastRow -2;
  var row = tbl.insertRow(lastRow -1);

  // Campo Data Dinâmico
  var tblCell = row.insertCell(0);
  var el = document.createElement('input');
  el.type = 'text';
  el.name = 'dtReferencia' + iteration;
  el.id = 'dtReferencia' + iteration;
  el.setAttribute("style","width:80px;");
  tblCell.appendChild(el);

  //el.onblur = function(){fcnCalculaMesAcrescimo('<
%=dataGravacaoPrevisao%>',this.value,iteration)};

  //document.getElementById('dtReferencia'+iteration).setAttribute
("onfocus", "this.className='nome_da_classe_over");

  rules[idxUltimaRegra-9]='dtReferencia' + iteration + '|required';
  rules[idxUltimaRegra-8]='dtReferencia' + iteration + '|date';
  rules[idxUltimaRegra-7]='dtReferencia' + iteration + '|mask|mydata';

  // Campo Percentagem Dinâmico 2d
  var tblCell = row.insertCell(1);
  var el = document.createElement('input');
  el.type = 'text';
  el.name = 'percentagem2d' + iteration;
  el.id = 'percentagem2d' + iteration;
  tblCell.appendChild(el);
  rules[idxUltimaRegra-6]='percentagem2d' + iteration + '|mask|
mypercentagem';

  // Campo Percentagem Dinâmico 3d
  var tblCell = row.insertCell(2);
  var el = document.createElement('input');
  el.type = 'text';
  el.name = 'percentagem3d' + iteration;
  el.id = 'percentagem3d' + iteration;
  tblCell.appendChild(el);
  rules[idxUltimaRegra-5]='percentagem3d' + iteration + '|mask|
mypercentagem';

  // Campo Percentagem Dinâmico 4d
  var tblCell = row.insertCell(3);
  var el = document.createElement('input');
  el.type = 'text';
  el.name = 'percentagem4d' + iteration;
  el.id = 'percentagem4d' + iteration;
  tblCell.appendChild(el);
  rules[idxUltimaRegra-4]='percentagem4d' + iteration + '|mask|
mypercentagem';

  // Campo Percentagem Dinâmico 5d
  var tblCell = row.insertCell(4);
  var el = document.createElement('input');
  el.type = 'text';
  el.name = 'percentagem5d' + iteration;
  el.id = 'percentagem5d' + iteration;
  tblCell.appendChild(el);
  rules[idxUltimaRegra-3]='percentagem5d' + iteration + '|mask|
mypercentagem';
  // Campo Percentagem Dinâmico 6d
  var tblCell = row.insertCell(5);
  var el = document.createElement('input');
  el.type = 'text';
  el.name = 'percentagem6d' + iteration;
  el.id = 'percentagem6d' + iteration;
  tblCell.appendChild(el);
  rules[idxUltimaRegra-2]='percentagem6d' + iteration + '|mask|
mypercentagem';

  // Campo Percentagem Dinâmico 7d
  var tblCell = row.insertCell(6);
  var el = document.createElement('input');
  el.type = 'text';
  el.name = 'percentagem7d' + iteration;
  el.id = 'percentagem7d' + iteration;
  tblCell.appendChild(el);
  rules[idxUltimaRegra-1]='percentagem7d' + iteration + '|mask|
mypercentagem';

  // Campo Percentagem Dinâmico Acr
  var tblCell = row.insertCell(7);
  var el = document.createElement('input');
  el.type = 'text';
  el.name = 'percentagemAcr' + iteration;
  el.id = 'percentagemAcr' + iteration;
  tblCell.appendChild(el);
  rules[idxUltimaRegra]='percentagemAcr' + iteration + '|mask|
mypercentagem';

  document.getElementById('contRowsPercentagem').value=parseInt
(document.getElementById('contRowsPercentagem').value)+1;
  yav.init('frmPercentagem',rules);

}

function fcnCalculaMesAcrescimo(dtPrevisao,dtReferencia,iteration)
{
 var ano = dtPrevisao.split( "/" )[2].toString();
 var mes = dtPrevisao.split( "/" )[1].toString();
 var dia = dtPrevisao.split( "/" )[0].toString();
 dtPrevisaoConvertida = new Date(parseInt(ano),parseInt(mes)-1,parseInt
(dia));

 var ano = dtReferencia.split( "/" )[2].toString();
 var mes = dtReferencia.split( "/" )[1].toString();
 var dia = dtReferencia.split( "/" )[0].toString();
 dtReferenciaConvertida = new Date(parseInt(ano),parseInt
(mes)-1,parseInt(dia));

 msPorDia = 24 * 60 * 60 * 1000;
 dif= (dtPrevisaoConvertida-dtReferenciaConvertida)/msPorDia;
 dif = Math.round(dif/30);

 document.getElementById('percentagemAcr'+iteration).value = '';
 document.getElementById('percentagem2d'+iteration).value='100';
 document.getElementById('percentagem3d'+iteration).value='100';
 document.getElementById('percentagem4d'+iteration).value='100';
 document.getElementById('percentagem5d'+iteration).value='100';
 document.getElementById('percentagem6d'+iteration).value='100';
 document.getElementById('percentagem7d'+iteration).value='100';
 document.getElementById('percentagemAcr'+iteration).value=dif;

}

</script>
    <h3>Seleçăo de Datas</h3>

    <form name="frmPercentagem" id="frmPercentagem" method="POST"
action="<%=Request.ServerVariables("SCRIPT_NAME")%>" onsubmit="return
yav.performCheck('frmPercentagem', rules, 'classic')"/>
                <input type="hidden" name="flgFrmPercentagem" id="flgFrmPercentagem"
value="true" />
                <input type="hidden" name="data" id="data" value="<%=data%>" />
                <input type="hidden" name="nuDiasPrevisao" id="nuDiasPrevisao"
value="" />
                <input type="hidden" name="contRowsPercentagem"
id="contRowsPercentagem" value="1" />

                <table style="text-align:right;" border="1" id="tblPercentagem"
name="tblPercentagem"/>
                        <tr>
                                <td colspan="8" class="sTitle">Título
                                </td>
                        </tr>
                        <tr style="font-weight:bold;">
                                <td>DATA
                                </td>
                                <td>2ș
                                </td>
                                <td>3ș
                                </td>
                                <td>4ș
                                </td>
                                <td>5ș
                                </td>
                                <td>6ș
                                </td>
                                <td>7ș
                                </td>
                                <td>%
                                </td>
                        </tr>
                        <tr>
                                <td><input type="text" name="dtReferencia" id="dtReferencia"
value="" style="width:80px;" onblur="javascript:fcnCalculaMesAcrescimo
('<%=dataGravacaoPrevisao%>',this.value,'');"/>
                                </td>
                                <td><input type="text" name="percentagem2d" id="percentagem2d"
value="" />
                                </td>
                                <td><input type="text" name="percentagem3d" id="percentagem3d"
value="" />
                                </td>
                                <td><input type="text" name="percentagem4d" id="percentagem4d"
value="" />
                                </td>
                                <td><input type="text" name="percentagem5d" id="percentagem5d"
value="" />
                                </td>
                                <td><input type="text" name="percentagem6d" id="percentagem6d"
value="" />
                                </td>
                                <td><input type="text" name="percentagem7d" id="percentagem7d"
value="" />
                                </td>
                                <td><input type="text" name="percentagemAcr" id="percentagemAcr"
value="" />
                                </td>
                        </tr>
                        <tr>
                                <td><a href="#" onclick="javascript:addRowToTablePercentagem
()">Adicionar mais Datas</a>
                                </td>
                                <td colspan="7" style="text-align:right"><input type="submit"
id="submit" name="submit" value="Gravar" style="width:150px;"/>
                                </td>
                        </tr>
                </table>
        </form>
</body>
</html>
<script type="text/javascript">
        var rules=new Array();
    rules[0]='dtReferencia|required';
    rules[1]='dtReferencia|date';
    rules[2]='dtReferencia|mask|mydata';

    rules[3]='percentagem2d|mask|mypercentagem';
    rules[4]='percentagem3d|mask|mypercentagem';
    rules[5]='percentagem4d|mask|mypercentagem';
    rules[6]='percentagem5d|mask|mypercentagem';
    rules[7]='percentagem6d|mask|mypercentagem';
    rules[8]='percentagem7d|mask|mypercentagem';
    rules[9]='percentagemAcr|mask|mypercentagem';

    yav.addMask('mydata', '  /  /    ', '1234567890');
    yav.addMask('mypercentagem', '  ,  ', '1234567890');
    yav.init('frmPercentagem', rules);
    var idxUltimaRegra = 9
</script>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »