Home | Products | Consulting | Forums | Support | Order | 1-800-752-0455
  Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: Listings Manager (Realty Manager & Auto Manager):
Display text in drop down menu - javascript code to call all options

 

 


CatD
New User

Jun 6, 2008, 2:27 AM

Post #1 of 2 (706 views)
Shortcut
Display text in drop down menu - javascript code to call all options Can't Post

Hi, I have setup a search that when a certain county is choosen the corresponding towns appear (ireland if your wondering counties / towns Smile ).

I am using a js array to control this :



Code
   

// State lists
var states = new Array();

states['county'] = new Array('CHOOSE LOCALITY');
states['Kildare'] = new Array('','Allenwood','Broadford','Caragh','Carbury','Celbridge','Clane','Coill Dubh','Derrinturn','Enfield','Johnstown','Johnstownbridge','Kilcock','Kilcullen','Hill','Leixlip','Maynooth','Naas','Prosperous','Robertstown','Sallins','Straffan');
states['Dublin'] = new Array('','Adamstown','City West','Clondalkin','Clonee','Kingswood','Lucan','Newcastle','Palmerstown','Park West','Rathcoole','Saggart','Tallaght');
states['Meath'] = new Array('','Ballivor','Clonard','Clonee','Enfield','Johnstown','Kilcock','Longwood','Summerhill','Trim');


function setStates() {
cntrySel = document.getElementById('lfield3_keyword');
stateList = states[cntrySel.value];
changeSelect('lfield4_keyword', stateList, stateList);
}


function changeSelect(fieldID, newOptions, newValues) {
selectField = document.getElementById(fieldID);
selectField.options.length = 0;
for (i=0; i<newOptions.length; i++) {
selectField.options[selectField.length] = new Option(newOptions, newValues);
}
}


function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}

addLoadEvent(function() {
setStates();
});



Which works fine but I want to display CHOOSE LOCALITY text in the drop down menu when the person chooses county, however this means that the person must choose a town for the search to work. I want the CHOOSE LOCALITY text also to work as ANY button but I am not sure how to do this as I need to leave the .js array first field blank to enable the code to call all properties.

I hope this makes sense. Thanks for any help in advance.

Cat


Jake
Staff / Moderator


Jun 6, 2008, 1:16 PM

Post #2 of 2 (658 views)
Shortcut
Re: [CatD] Display text in drop down menu - javascript code to call all options [In reply to] Can't Post

Hi Cat,

Working with javascript like this goes beyond our support capabilities here, however there are a lot of users on the forum who have more experience with javascript like this. Hopefully one of them will be able to jump in here and offer you some assistance. Smile
-----------------------------------------------------------
Cheers,
Jake Swanson - Product Specialist
support@interactivetools.com


Hire me!
Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.


 
 
 


Search for (options)
Products
CMS Builder
Article Manager
Realty Manager
Listings Manager
Order Now
Services
Priority Consulting
Support
Online Documentation
Support Forums
Support Homepage
Company Info
12 reasons to choose us!
Meet the team
Monthly newsletter
Contact Us
Toll Free: 1-800-752-0455
Phone: (604) 689-3347
Sales | Support
Conditions of Use | Privacy Policy | Copyright © interactivetools.com 2008
#201 - 2730 Commercial Drive, Vancouver BC Canada V5N 5P4