I'm building a site using Joomla with Community Builder. A problem I'm having is dependent field values is not built into the registration/edit profile forms and I really need this functionality to keep the search results clean so that all location values are the same. I have a js script that allows this functionality and I can get this to work by creating my own custom registration form, however I need this to actually integrate with the community builder registration form and edit profile form it's self. In order to set the dependency on a field with this script you basically just add "DEPENDS ON (prior field) BEING (value)" to the input type class. The problem I'm having is the community builder registration form is obviously php so it pulls the fields and values from the database then renders it into a form on a page, the actual fields and values are created in the administrator back end of the site. What I really need to do is build a plugin to install into community builder to add this functionality and set up an option to set the dependency on the field from the admin back end, but I can't do that until I actually understand how to add the dependency line to the input class in the php file first. Here is a link to the cbcore php file (in a txt file), sorry I had to do it this way but the code is too long to stick it right in the forum post: http://www.erecoverydev.com/cbcore.txt Here's the script I'm using: var FORM_MANAGER_CONDITION_SEPARATOR = " AND "; var FORM_MANAGER_POSSIBILITY_SEPARATOR = " OR "; var FORM_MANAGER_NAME_VALUE_SEPARATOR = " BEING "; var FORM_MANAGER_DEPENDS = "DEPENDS ON "; var FORM_MANAGER_CONFLICTS = "CONFLICTS WITH "; var FORM_MANAGER_EMPTY = "EMPTY"; function addEvent(el, ev, f) { if(el.addEventListener) el.addEventListener(ev, f, false); else if(el.attachEvent) { var t = function() { f.apply(el); }; addEvent.events.push({'element': el, 'event': ev, 'handler': f}); el.attachEvent("on" + ev, t); } else el['on' + ev] = f; } function addEvents(els, evs, f) { for(var i = 0; i < els.length; ++i) for(var j = 0; j < evs.length; ++j) addEvent(els[i], evs[j], f); } addEvent.events = []; if(typeof window.event !== "undefined") addEvent(window, "unload", function() { for(var i = 0, e = addEvent.events; i < e.length; ++i) e[i].element.detachEvent("on" + e[i].event, e[i].handler); } ); function getRadioValue(el) { if(!el.length) return null; for(var i = 0; i < el.length; ++i) if(el[i].checked) return el[i].value; return null; } function getSelectValue(el) { if(!el.tagName || el.tagName.toLowerCase() !== "select") return null; return el.options[el.selectedIndex].value; } function isElementValue(el, v) { if(v === FORM_MANAGER_EMPTY) v = ''; return ( getRadioValue(el) == v || getSelectValue(el) == v || ( el.tagName && el.tagName.toLowerCase() !== "select" && el.value == v ) ); } function setupDependencies() { var showEl = function() { this.style.display = ""; if(this.parentNode.tagName.toLowerCase() == "label") this.parentNode.style.display = ""; }; var hideEl = function() { this.style.display = "none"; if(typeof this.checked !== "undefined") this.checked = false; else this.value = ""; if(this.parentNode.tagName.toLowerCase() == "label") this.parentNode.style.display = "none"; this.hidden = true; }; var calcDeps = function() { for(var i = 0, e = this.elements; i < e.length; ++i) { e[i].hidden = false; for(var j = 0, f = e[i].className.split(FORM_MANAGER_CONDITION_SEPARATOR); j < f.length; ++j) if(f[j].indexOf(FORM_MANAGER_DEPENDS) === 0) { for(var k = 0, g = f[j].substr(FORM_MANAGER_DEPENDS.length).split(FORM_MANAGER_POSSIBILITY_SEPARATOR); k < g.length; ++k) if(g[k].indexOf(FORM_MANAGER_NAME_VALUE_SEPARATOR) === -1) { if(e[g[k]] && e[g[k]].checked) break; else if(k + 1 == g.length) e[i].hide(); } else { var n = g[k].split(FORM_MANAGER_NAME_VALUE_SEPARATOR), v = n[1]; n = n[0]; if(e[n]) if(isElementValue(e[n], v)) break; else if(k + 1 == g.length) e[i].hide(); } } else if(f[j].indexOf(FORM_MANAGER_CONFLICTS) === 0) { if(f[j].indexOf(FORM_MANAGER_NAME_VALUE_SEPARATOR) === -1) { if(e[f[j].substr(FORM_MANAGER_CONFLICTS.length)] && e[f[j].substr(FORM_MANAGER_CONFLICTS.length)].checked) { e[i].hide(); break; } } else { var n = f[j].substr(FORM_MANAGER_CONFLICTS.length).split(FORM_MANAGER_NAME_VALUE_SEPARATOR), v = n[1]; n = n[0]; if(e[n]) { if(isElementValue(e[n], v)) { e[i].hide(); break; } } } } if(!e[i].hidden) e[i].show(); } }; var changeHandler = function() { this.form.calculateDependencies(); return true; }; for(var i = 0; i < arguments.length; ++i) { for(var j = 0, e = window.document.forms[arguments[i]].elements; j < e.length; ++j) { addEvents([e[j]], ["change", "keyup", "focus", "click", "keydown"], changeHandler); e[j].hide = hideEl; e[j].show = showEl; } (e = window.document.forms[arguments[i]]).calculateDependencies = calcDeps; e.calculateDependencies(); } } Code (markup): Here's an example of this in a regular html form: <tr id="cbfr_64" class="sectiontableentry2 cbft_select"> <td class="titleCell"><label for="cb_cityal">City:<input class="DEPENDS ON cb_state BEING Alabama OR cb_state BEING Alaska OR cb_state BEING Arizona etc etc etc" type="hidden" /></label></td> <td id="cbfv_64" class="fieldCell"><select id="cb_cityal" class="inputbox AND DEPENDS ON cb_country BEING United States AND DEPENDS ON cb_state BEING Alabama" name="cb_cityal"> <option> </option></select> Code (markup): How would I get the DEPENDS ON value into the input type class using php in the cbcore.php file?