[Seaside] RE: JQuery ui autocomplete with multiple parameters

Dav lasmiste at gmail.com
Tue Aug 28 07:47:06 UTC 2012

Hi Robert,
 I solved it. I haven't data on client and I don't use the blur event, it's
enough to read the "name" value via JQuery.

On JQAutocomplete, I implemented a method mimicking
JQAutocomplete>>sourceCallback: but with a two arguments block

JQAutocomplete>>customSourceCallback: aTwoArgumentsBlock
	|  term1 term2 |
	self source: ((self jQuery getJson

		callback: [ :value | term1 := value ] value: (JSStream on:
		callback: [ :value | term2 := value ] value: (JSStream on:
		text: [ :stream | stream json: (aTwoArgumentsBlock value: term1
		onSuccess: 'response(arguments[0])'; 
		dataType: 'jsonp') asFunction: #('request' 'response'))

request.term is "address" field and you can see I easily grabbed the "name"

Eventually, on my class, I linked the autocomplete to "address" field this

  self addressField script: (html jQuery this autocomplete delay: 0;
customSourceCallback: [ :address :name| self tryToFind: address and: name

In MyClass>>tryToFind:and: I made the search. That's it.


View this message in context: http://forum.world.st/JQuery-ui-autocomplete-with-multiple-parameters-tp4645397p4645458.html
Sent from the Seaside General mailing list archive at Nabble.com.

More information about the seaside mailing list