Ajax Menu2 SetUp
What is an ajax Menu2?
What is the proper format for setting up the ajax menu2 option?
Can I have two or more ajax menu2 options?
The ajax "menu2" option allows for a two-level drop down menu in a questionnaire. After you select the first optoin, the second option is populated so you can make your choice.
To set up an ajax menu2 question, you simply go to Basic Site Settings -> Questionnaire and then choose the appropriate option. Choose the "Multi-Menu Two" option for a new question. The ID = dropdown is what you use to select an ID between 1 and 9. This corresponds to the message in the message base that matches this number. For example, if you choose "2", your i_menu entry in the message base must be ajax:2. When you create a new question, a placeholder with that ID will be entered in the message base.
Then to actually set up your two level menu, you go to the info messages and edit the corresponding message according to the following parameters.
The format below must be followed exactly.
- You ajax listing needs to begin with: <as-ajax_menu2>
- You cannot use <> anywhere in your text
- DO NOT use the HTML editor to edit the message.
- Do not change the menu entry from "ajax:01"
- Each child must have it's own unique id field.
- The unique id field must only contain letters, numbers and the underscore.
- Do not use special characters like bold <b> or <i> etc.
- Never use "quotes" or an apostrophe (').
The last point is very important in that you'll have to use appropriate abbreviations. For example, "Mar's Hill Church" will have to be listed as "Mars Hill Church". It may not be technically correct but apostrophe's and "quotes" need to be avoided.
If you scroll to the bottom, you'll see what the final product looks like. It is pretty straight forward, but the following gives a more detailed technical explanation to help you more fully understand.
The way it works, is that you are have a parent and a child menu item. In the example below, the "parents" are Arizona, California and Idaho.
The parents are surrounded by brackets < >.
So if we just had parents, our listing would look like this:
<Arizona>
<California>
<Idaho>
The children then follow the parents, each on a separate line. Each child must have a unique identifier (uID) and a name that is separated by <>. The uID must only contain letters, spaces and an underscore. Keep in mind that when you run a dump of all of your data or view an analytical report, it is the uID code that will show up so make sure you include enough data so it makes sense.
So for Arizona we have three children, let's take the first one:
The name is: First Baptist Church of Tucson and the uID is: AZ101
So when we join the uID and name with our separator <> we get: AZ101<>Tucson
But we want to include the uID in the name description so the full line becomes: AZ101<>AZ 101 - Tucson
Adding our second and third entries, using the same format our listing becomes:
AZ101<>AZ 101 - Tucson
AZ102<>AZ 102 - Phoenix
AZ103<>AZ 103 - Flagstaff
If we add the parent (Arizona) for this state, plus a couple of other states, and then our header/footer, our listing looks like this:
<as-ajax_menu2>
<Arizona>
AZ101<>AZ 101 - Tucson
AZ102<>AZ 102 - Phoenix
AZ103<>AZ 103 - Flagstaff
<California>
CA101<>CA 101 - San Bernardino
CA102<>CA 102 - Redlands
<Idaho>
ID101<>ID 101 - Pocatello
ID102<>ID 102 - Living Waters of Boise
</as-ajax_menu2>
You can just build this out for all of the states. If you wanted to split a big state, you could even do that. For example,
<California - Southern>
<California - Northern>
It is really important to understand the difference between the name and the uID on each child line. The uID is what will show up on reports and analytics. The name is what the end user sees. So just because you're seeing them all on one line when you're setting them up, the end users will only see the name and the reports will only show the uID (unique identifier).
Actual Questions asked by Users:
Am I allowed to enter text for instructions before entering the location info? Yes, but not as a part of the info message. The i_msg field has to begin with the <as-ajax_menu2> and has to end with </as-ajax_menu2>. Any text before or after the <as…will cause it to crash. The text between the brackets also must follow the above guidelines very explicitly. We're using the i_msg as a type of database call, so it has to be formatted exactly. You can use the questionnaire features to add extra lines of text as you would with any question.
If I repeat the unique identifier (uID) in the name, does it have to be exact or can it be a little different? It can be different. For example, if your unique ID is SanD1, your name can repeat it as San Diego in the name.
In the above example, how would I two different locations in the same city? The most critical element is for each child is the unique ID. (uID). So if you had two sites with the same sity name, just make sure the uID are different. For example, these are unique:
<California>
Highland_1<>Highland, East Side
Highland_2<>Highland, West Side
But these are not:
<California>
Highland<>Highland, East Side
Highland<>Highland, West Side