calling two jQuery function, onChange -
hi calling remotefunction in onchange event. want when user select parent dropdown, child dropdown belong parent id display default child block hidden. how call 2 function in onchange event.
my code:
<g:select optionkey="id" from="${commonlist}" class="fullborderbox" value="${value?."${propertyname}"?."${commonpropertyname}"?.id}" name="${commonpropertyname}.id" noselection="${['null': message(code: 'common.list.select')]}" onchange="${remotefunction( controller: 'middlewaredata', action: 'populateversion', params: "'typeid=' + this.value + '&&lookupproperty=' + '${commonpropertyname}'", update: "populateswversion${dataindex}" )}; $("#versionblock${dataindex}").hide();"/> <span id="versionblock${dataindex}"> test="${value?."${propertyname}"?."${commonpropertyname}"?.id}"> <g:select optionkey="id" from="${propertylist}" class="fullborderbox" name="dummyval" value="${value?."${propertyname}"?.id}" noselection="${['null': message(code: 'common.list.select')]}" onclick="populateversionlist(null);" /> </span> %{---pass dynami id populate version block pick list----}% <span id="populateswversion${dataindex}"></span>
don't need write js handler in html. move call event function in js. whatever logic want.
${remotefunction( controller: 'middlewaredata', action: 'populateversion', params: "'typeid=' + this.value + '&&lookupproperty=' + '${commonpropertyname}'", update: "populateswversion${dataindex}" )}; $("#versionblock${dataindex}").hide();
move code js function. callback can call as other function want.
// make server call function getdata(){ $.ajax({ //.... }); }
then wire function on change event,
onchange="getdata()"
Comments
Post a Comment