Open cspeerly opened 11 years ago
So, you mean change dynamically source of typeahead, right? For that you can use
$('#zipcode').editable('option', 'source', 'group-tn.php');
Sorry I am not good at java or ajax. I know there is a way to do this. Just can't figure it out.
What I want is if the user selects A state from the source list in ('#State.editables({
('#State').editable({
mode: 'inline',
type: 'select',
pk: 1,
url: 'post.php',
name:'State',
value: 'TN',
title: 'Enter State',
source: "[{value: 'AL', text: 'Alabama'},{value: 'AK', text: 'Alaska'},{value: 'AZ', text: 'Arizona'},{value: 'AR', text: 'Arkansas'},{value: 'CA', text: 'California'},{value: 'CO', text: 'Colorado'},{value: 'CT', text: 'Connecticut'},{value: 'DE', text: 'Delaware'},{value: 'FL', text: 'Florida'}]",
});
The group name will change like this in the ('#Zip.editables({
$('#zip').editable({
mode: 'inline',
type: 'select',
pk: 1,
url: 'post.php',
name:'zip',
value: '38128',
title: 'Enter zip',
source: "groups-{ value from the ('#State').editable }.php",
});
If users selects Alabama from ('#State').editable({ then in $('#zip').editable({ source "groups-AL.php",
If users selects Delaware from ('#State').editable({ then in $('#zip').editable({ source "groups-DE.php"
If users selects Florida from ('#State').editable({ then in $('#zip').editable({ source "groups-FL.php"
etc.
Thank's
Chuck
save
event should help:
$('#State').on('save', function(e, params){
var source = 'group-'+params.newValue+'.php';
$('#zip').editable('option', 'source', source);
})
I have a ZipCodes List for all of the USA states. I want to use this with typeahead where user can enter city state or zip and it comes up. I can break it down to individual files for each state like this in the groups-tn.php file the array is set like this. array('value' => '37010', 'text' => 'ADAMS TN 37010'),
Now the Problem: If I put all USA ZipCodes in this one file it takes forever to load and sometimes errors out. Seeing that when a user enters his state, the ZipCodes would only be needed for that state. So, If user enters Tennessee for his state it will change the group-??.php in the ZipCodes config to group-tn.php EXAMPLE: group-{value.state}.php
I can do it if the value state is already set when the edit record opens for edit. but, on add new record or change the state name. I can't get it to update the ZipCode config group-??.php to the correct state name.