0
내 웹 사이트 중 하나가 국가, 주 및시 autosuggest 용 http://digitarald.de/project/autocompleter/ 플러그인을 확장 중입니다.Mootools Autosuggestion Customization
예 : 상태는 검색 텍스트 및 국가 코드와 같은 두 개의 입력이 있어야합니다. 위의 플러그인의 문서에서
여러 인수를 전달하는'postVar' : 'text',
'postData':{'country':$('country'.get('value'))},
를 사용한다.
여기 $('country')
은 첫 번째 제안에서 국가 코드를 설정합니다. 이제 문제는 내가 입력으로 country
을 보낼 수 없기 때문에 동적 자바 스크립트 호출에서 그것의 세트. 문제를 해결하는 방법.
var countryAutocomplete = new Autocompleter.Request.JSON('countrySearch', 'www.example.com/country', {
'postVar' : 'text',
'minLength': 1,
'injectChoice': function(areas){
var choice = new Element('li', {'class': 'autocompleter-choices1', 'id':areas.label});
new Element('div', {'html': this.markQueryValue(areas.label),'class': 'autocompleter-choice1'}).inject(choice);
this.addChoiceEvents(choice).inject(this.choices);
choice.store('autocompleteChoice', areas);
}
});
//set the selected value in a hidden field
countryAutocomplete.addEvent('onSelection', function(element, selected, value, input) {
$('country').value = country = selected.retrieve('autocompleteChoice').id;
});
// suggets states
var stateAutocomplete = new Autocompleter.Request.JSON('stateTxt', 'www.example.com/state', {
'postVar' : 'text',
'postData':{'postData':{'country':$('country'.get('value'))},},
'minLength': 3,
'injectChoice': function(areas){
var choice = new Element('li', {'class': 'autocompleter-choices1', 'id':areas.label});
new Element('div', {'html': this.markQueryValue(areas.label),'class': 'autocompleter-choice1'}).inject(choice);
this.addChoiceEvents(choice).inject(this.choices);
choice.store('autocompleteChoice', areas);
}
});
어떤 도움에 감사합니다 다음과 같이
는 시도.감사
답변 해 주셔서 감사합니다. :) – abhis