dinamic search box goto url

Mma87 01 Apr, 2012
hi all,

using this guide
http://forum.joomla.it/index.php?topic=95733.0
I created a dinamic search box, every choice of the second dropdown has a specific page but I need to connect the selections with a different url and when the user presses the search button, it is redirected to the url provided

I use joomla 1.5 and chrnoform 3.1

can someone help me?

best reguards
Matteo
GreyHead 02 Apr, 2012
Hi Matteo.

I'm sorry, my Italian isn't good enough to understand the article so I have no real idea what your problem is.

Bob
Mma87 02 Apr, 2012
don't you worry Bob, I try to explain better:
there is the first dropdown menu with the sections (eg. of the article) and the second dropdown (the category of article) that is a dinamic dropdown because choose from the options change depending on the selected section in the first dropdown
this is the html code
<!-- inizio codice campi form -->

<div class="form_item">
        <div class="form_element cf_dropdown">
          <div style="clear:both;"><label class="cf_label">Sezioni</label>
            
<select name="id_sezione"  onfocus="fillCategory();" onChange="SelectCategoria();" class="cf_inputbox validate-selection"  ><Option value="">Seleziona</option>

</select> Categorie 

       <select id="id_categoria" name="categoria" class="cf_inputbox validate-selection" ><Option value="">Seleziona</option>
       
</select>
       
 </div>    
    </div>
  <div class="cfclear"> </div>
</div>



<div class="form_item">
  <div class="form_element cf_button">
    <input value="Invia" name="button_1" type="submit" /><input type="reset" name="reset" value="Reset"/>
  </div>
  <div class="cfclear"> </div>
</div>


and this is the js code
//questo è il codice da inserire nella TAB Form Code sezione javascript 

function fillCategory(){
removeAllOptions(document.getElementById('ChronoContact_atto_10').cod_sezione);


 addOption(document.getElementById('ChronoContact_atto_10').cod_sezione, '1', 'sezione 1'); 
 addOption(document.getElementById('ChronoContact_atto_10').cod_sezione, '2', 'sezione 2'); 
 addOption(document.getElementById('ChronoContact_atto_10').cod_sezione, '3', 'sezione 3'); 
}

function SelectSubCat(){
// Funzione chiamata dopo la selezione della Sezione - ON or after selection of category this function will work

removeAllOptions(document.getElementById('ChronoContact_atto_10').cod_categoria);
//addOption(document.getElementById('ChronoContact_atto_10').cod_categoria, "", "Seleziona", "");

// Raccoglie tutti gli elementi della categoria per id - Collect all element of subcategory for various id 


 if (document.getElementById('ChronoContact_atto_10').cod_sezione.value == '1'){ 
 addOption(document.getElementById('ChronoContact_atto_10').cod_categoria,'1', 'categoria 1 sez 1'); 
 addOption(document.getElementById('ChronoContact_atto_10').cod_categoria,'2', 'categoria 2 sez 1'); 
 addOption(document.getElementById('ChronoContact_atto_10').cod_categoria,'6', 'categoria 3 sez 1'); 
 addOption(document.getElementById('ChronoContact_atto_10').cod_categoria,'7', 'categoria 4 sez 1'); 
}
 if (document.getElementById('ChronoContact_atto_10').cod_sezione.value == '2'){ 
 addOption(document.getElementById('ChronoContact_atto_10').cod_categoria,'3', 'categoria 1 sez 2'); 
 addOption(document.getElementById('ChronoContact_atto_10').cod_categoria,'4', 'categoria 2 sez 2'); 
 addOption(document.getElementById('ChronoContact_atto_10').cod_categoria,'5', 'categoria 3 sez 2'); 
}
 if (document.getElementById('ChronoContact_atto_10').cod_sezione.value == '3'){ 
 addOption(document.getElementById('ChronoContact_atto_10').cod_categoria,'9', 'categoria 1 sez 3'); 
 addOption(document.getElementById('ChronoContact_atto_10').cod_categoria,'10', 'categoria 2 sez 3'); 
}



}
////////////////// 

function removeAllOptions(selectbox)
{
   var i;
   for(i=selectbox.options.length-1;i>=1;i--)
   {
      selectbox.options[i]=null;
      //selectbox.remove(i);
   }
}


function addOption(selectbox, value, text )
{
   var optn = document.createElement("option");
        
        optn.text = text;
   optn.value = value;

   selectbox.options.add(optn);
          //selectbox.appendChild(optn,where);

}


now, I need to have the code that, when the user chooses the category and click the submit button the form leads him to a specific page.

I hope I was able to explain well🙂
This topic is locked and no more replies can be posted.