Custom Javascript perhaps?

Hello Team,
Thank you guys for this awesome school management system.
I was thinking of how to use Javascript to solve a challenge that we have at our school. My country is divided into 37 state regions and these states have towns in them. In all there are over 300 towns. We need to capture all user’s native State and Town into Gibbon. Using custom fields for the States was easy but now I am stuck on how to do a custom field for the Towns. I noticed that the limit for the number of options in drop down custom field cannot accommodate the towns. So I thought if I could create an empty drop down custom field and then have Javascript dynamically populate a State’s towns from database into this empty drop down based on a user’s chosen State option. Custom script loaders can only load content into the home page when a user is logged in so this cannot work for me (I thought this feature could help me load the Javascript into the forms).
Team, please what can I do?

Hi tejumann,

The district field may be useful here, you could use a String Replacement in System Admin to rename district to town, and then enter the towns you need in the Manage Districts page under User Admin. The district field in the application form and user data is auto-completed from the available list of districts. If you have access to your database with a tool that lets you import a csv or spreadsheet (PHPMyAdmin, Sequel Pro, etc) you could bulk-upload your 300 towns into the gibbonDistrict table.

Hope this helps!

Hello Sandra,

Thank you very much for this. I tested it and it works. Now I wonder how to get these two fields in the same section. Is this possible?

Hmm, that’s a good question, right now there’s no way to determine where the custom fields display without editing the code, which can be tricky for maintaining with future updates. I wonder, since the state that a town is in is a fixed value, if you could use the district field to represent both the state and the town. Eg: edit the districts so they list “State Name, Town Name” for each town.

You are quite right about editing the code. I will test out this solution you offered.

Many thanks Sandra