Created
March 30, 2011 04:18
-
-
Save fmpwizard/893857 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def stateDropDown = SHtml.ajaxSelect( | |
CitiesAndStates.states.map(i => (i, i)), | |
Full(1.toString), | |
selected => { | |
//What to do when you select an entry | |
Info.selectedState.set(selected) | |
state= selected | |
Noop | |
} | |
) | |
def cityDropDown(in: NodeSeq) = | |
WiringUI.toNode(in, Info.cities, JqWiringSupport.fade)((d, ns) => cityChoice(state)) | |
private def cityChoice(state: String): Elem = { | |
val cities = CitiesAndStates.citiesFor(state) | |
val first = cities.head | |
// make the select "untrusted" because we might put new values | |
// in the select | |
untrustedSelect(cities.map(s => (s,s)), Full(first), s => city = s) | |
} | |
def idDropDown(in: NodeSeq) = | |
WiringUI.toNode(in, Info.ids, JqWiringSupport.fade)((d, ns) => idChoice(state)) | |
private def idChoice(state: String): Elem = { | |
val ids = CitiesAndStates.idsFor(state) | |
val first = ids.headOption | |
// make the select "untrusted" because we might put new values | |
// in the select | |
untrustedSelect(ids.map(s => (s,s)), first, s => id = s) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment