[Proto-Scripty] Re: is there any problem with RegExp??

2009-03-11 Thread Tobie Langel

Short answer: No.

For a longer answer to your particular problem, you'll have to provide
more code. :)

Best,

Tobie
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: is there any problem with RegExp??

2009-03-11 Thread eulerss

ok, here is my code of my function on javascript only, i dont know if
its causing some conflict

function filtr2(){

gr=document.pedido.elements['tipo_final'];
grval=gr.options[gr.selectedIndex].value;

gr2=document.pedido.elements['marca_final'];
grval2=gr2.options[gr2.selectedIndex].value;

pto=document.pedido.elements['producto2'];
ftomod=document.pedido.elements['filtromodelo_final'].value;
pto.innerHTML='';

//sel=document.getElementById(tipodeobr);
//ped_tp=sel.options[sel.selectedIndex].value;

opN=0;

for (sub in productos_array2){

if(grval2=='Todos'){

filtro2=1;

}
else{

if (productos_array2[sub]['DMARCA']==grval2){
filtro2=1;
}
else{
filtro2=0;
}

}//fin union filtros

if ((productos_array2[sub]['ITGR']==grval  filtro2==1)  ||
(grval=='Todos'  filtro2==1)){

if (ftomod!='' ){

exreg= new RegExp(ftomod,i);  //regular 
expresion, i ignore the
case of characters
exreg2= new 
RegExp(ftomod.replace(/-/g,).replace(/,),i); //
regular expresion, g-global search, i-ignore case
!--if 
(productos_array2[sub]['ITNO'].search(exreg)==0 ||
productos_array2[sub]['ITNO'].replace(/-/g,).replace(/,).search
(exreg2)==0)--

if(productos_array2[sub]['ITNO'].search(exreg)==0)
{
var newOption = 
document.createElement(OPTION);
newOption.text= productos_array2[sub]['ITNO'].replace(/ 
/
g,)+' - '+productos_array2[sub]['FUDS'];
newOption.value= productos_array2[sub]['ITNO'];
pto.add(newOption);

}
}
else{

var newOption = document.createElement(OPTION);
newOption.text= productos_array2[sub]['ITNO'].replace(/ /
g,)+' - '+productos_array2[sub]['FUDS'];
newOption.value= productos_array2[sub]['ITNO'];
addOption(pto,opN++,newOption);

}  //else
}
}   //for
sortlist('proid2');
colocaimagen2();
}

and productos_array2 is my array with all options that i used to fill
the combobox

thanks

On 11 mar, 11:34, Tobie Langel tobie.lan...@gmail.com wrote:
 Short answer: No.

 For a longer answer to your particular problem, you'll have to provide
 more code. :)

 Best,

 Tobie
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: is there any problem with RegExp??

2009-03-11 Thread Tobie Langel

You shouldn't be using for... in to iterate over an array, see:
http://proto-scripty.wikidot.com/prototype:tip-looping-through-arrays


On Mar 11, 7:26 pm, eulerss eulers...@hotmail.com wrote:
 ok, here is my code of my function on javascript only, i dont know if
 its causing some conflict

 function filtr2(){

         gr=document.pedido.elements['tipo_final'];
         grval=gr.options[gr.selectedIndex].value;

         gr2=document.pedido.elements['marca_final'];
         grval2=gr2.options[gr2.selectedIndex].value;

         pto=document.pedido.elements['producto2'];
         ftomod=document.pedido.elements['filtromodelo_final'].value;
         pto.innerHTML='';

         //sel=document.getElementById(tipodeobr);
         //ped_tp=sel.options[sel.selectedIndex].value;

         opN=0;

         for (sub in productos_array2){

                 if(grval2=='Todos'){

                         filtro2=1;

                 }
                 else{

                         if (productos_array2[sub]['DMARCA']==grval2){
                                 filtro2=1;
                         }
                         else{
                         filtro2=0;
                         }

                 }//fin union filtros

         if ((productos_array2[sub]['ITGR']==grval  filtro2==1)  ||
 (grval=='Todos'  filtro2==1)){

         if (ftomod!='' ){

                                 exreg= new RegExp(ftomod,i);  //regular 
 expresion, i ignore the
 case of characters
                                 exreg2= new 
 RegExp(ftomod.replace(/-/g,).replace(/,),i); //
 regular expresion, g-global search, i-ignore case
                                 !--if 
 (productos_array2[sub]['ITNO'].search(exreg)==0 ||
 productos_array2[sub]['ITNO'].replace(/-/g,).replace(/,).search
 (exreg2)==0)--
                                         
 if(productos_array2[sub]['ITNO'].search(exreg)==0)
                                         {
                                         var newOption = 
 document.createElement(OPTION);
                         newOption.text= 
 productos_array2[sub]['ITNO'].replace(/ /
 g,)+' - '+productos_array2[sub]['FUDS'];
                                 newOption.value= 
 productos_array2[sub]['ITNO'];
                         pto.add(newOption);

                                         }
                                 }
         else{

                 var newOption = document.createElement(OPTION);
                 newOption.text= productos_array2[sub]['ITNO'].replace(/ /
 g,)+' - '+productos_array2[sub]['FUDS'];
                         newOption.value= productos_array2[sub]['ITNO'];
                 addOption(pto,opN++,newOption);

                                 }  //else
                 }
     }   //for
 sortlist('proid2');
 colocaimagen2();

 }

 and productos_array2 is my array with all options that i used to fill
 the combobox

 thanks

 On 11 mar, 11:34, Tobie Langel tobie.lan...@gmail.com wrote:

  Short answer: No.

  For a longer answer to your particular problem, you'll have to provide
  more code. :)

  Best,

  Tobie
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---