Bob (or anyone else with some ideas), I was hoping to pick your brains...
I'm creating a form where someone can enter in an sporting play/move. Each play must belong to a category, and they will select the appropriate category from a drop down list which pulls its values from a database table of categories.
The thing is that if they can't find a category that applies to what they are doing, I want to give users the option to add their own category. I'll place a button/link on the main form which will open up a separate form in a modal and they can add in the name of their new category and click save
Anyway, 2 questions:
-How can I close the modal after I have saved the category to the database. I'd rather not give them a success message and make them manually close it.
-Related to above, how can I make the new option visible (and 'selected') in the drop down list on the main form? I take I'll have to refresh the form? How do I do this automatically when the modal on top closes, and what effect will it have on the previously entered form data
?
If I'm approaching this in the wrong way, please suggest a better approach.
Regards
Andy
I'm creating a form where someone can enter in an sporting play/move. Each play must belong to a category, and they will select the appropriate category from a drop down list which pulls its values from a database table of categories.
The thing is that if they can't find a category that applies to what they are doing, I want to give users the option to add their own category. I'll place a button/link on the main form which will open up a separate form in a modal and they can add in the name of their new category and click save
Anyway, 2 questions:
-How can I close the modal after I have saved the category to the database. I'd rather not give them a success message and make them manually close it.
-Related to above, how can I make the new option visible (and 'selected') in the drop down list on the main form? I take I'll have to refresh the form? How do I do this automatically when the modal on top closes, and what effect will it have on the previously entered form data
?
If I'm approaching this in the wrong way, please suggest a better approach.
Regards
Andy
Hi Andy,
Your approach is ok and can be done using JS and AJAX, but its not something easy that I can give hints about, it will need a good amount of JS coding and testing.
Regards,
Max
Your approach is ok and can be done using JS and AJAX, but its not something easy that I can give hints about, it will need a good amount of JS coding and testing.
Regards,
Max
Hi Andy,
There's another approach to this using the AutoComplete and AutoLoader pair of actions:
The AutoComplete Loader and AutoComplete Processor that can be used to do 'as you type' lookups. That is: when you type a few characters in an input box linked to the AutoComplete Loader action they are sent to a second event with the AutoComplete Processor in it which returns a list of options; type another character and the options list is refreshed. Because this uses a text input element rather than a select element the user is not limited to the specified selections but can add a 'free-text' value instead.
Joomla! also uses (or used to) a Combo box which is a select-box with a write-in option that is then saved (I guess) in the database to be used in the future.
The problem with allowing write-in entries is that you can very quickly accumulate a lot of junk - some of it just small variants on existing entries, some typos, and some just plain junk.
Bob
There's another approach to this using the AutoComplete and AutoLoader pair of actions:
The AutoComplete Loader and AutoComplete Processor that can be used to do 'as you type' lookups. That is: when you type a few characters in an input box linked to the AutoComplete Loader action they are sent to a second event with the AutoComplete Processor in it which returns a list of options; type another character and the options list is refreshed. Because this uses a text input element rather than a select element the user is not limited to the specified selections but can add a 'free-text' value instead.
Joomla! also uses (or used to) a Combo box which is a select-box with a write-in option that is then saved (I guess) in the database to be used in the future.
The problem with allowing write-in entries is that you can very quickly accumulate a lot of junk - some of it just small variants on existing entries, some typos, and some just plain junk.
Bob
This topic is locked and no more replies can be posted.
