Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7409 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

You can use one of two basic concepts to achieve this.

One, when the Building dropdown is changed the database is queried and the page is reloaded with the options for the Room.

Two, all options are loaded into a Javascript array and whenever the Building is changed the Room options are automatically updated.

Over the weekend I will have look at your databases to see if any problems exist.

All the best.

Garry

Posted

You can find working examples of drop down lists in the Sample Files forum. Might be under -LOP values or -Op values and symbols or one of the other sample demonstratons in CDML.

Posted

Hi, I built some java arrays a short while ago after a LOT of help from the forum (like kinda writing the whole thing for me!)

The enclosed file has the java include file and the basic page html in one. I just hard-coded everything in as it would hardly ever change, but you could deliver the arrays from a database.

This example has two or three levels depending on the first choice and runs at

http://adserve.william-reed.net

- follow the "advert specs" link

regards, jeff

java_arrays.txt

Posted

Here is a working solution for your database.

Place this Javascript/CDML code in the <head> of the "helpdesk.html" format page:

<script>

var aBuildingNames = new Array();

var aBuildingRooms = new Array();

var aRooms = new Array();

var currBuilding = "";

var i = 0;

var j = 0;

[FMP-InlineAction: -db=Room.fp5, -sortfield=Building, -sortfield=Room, -max=all, -findall]

[FMP-Record]

if ("[FMP-Field:Building]" == currBuilding)

	{

	aRooms[i++] = "[FMP-Field:Room]";

	}

else

	{

	if (currBuilding != "")

		{

		aBuildingRooms[j++] = aRooms;

		var aRooms = new Array();

		i = 0;

		};

	currBuilding = "[FMP-Field:Building]";

	aRooms[i++] = "[FMP-Field:Room]";

	};

[/FMP-Record]

[/FMP-InlineAction]

aBuildingRooms[j++] = aRooms;



function updateRooms()

	{

	nRoomsOld = document.Survey.Room.options.length;

	for (a=nRoomsOld-1; a > 0; a--)

		{

		document.Survey.Room.options[a] = null;

		};

	nSelectedBuilding = document.Survey.Building.selectedIndex;

	nRoomLen = aBuildingRooms[nSelectedBuilding].length;

	for (a=0; a < nRoomLen; a++)

		{

		document.Survey.Room.options[a+1] = new Option(aBuildingRooms[nSelectedBuilding][a]) ;

		document.Survey.Room.options[a+1].value = aBuildingRooms[nSelectedBuilding][a] ;

		};

	};

</script>

</head>




Place this Javascript/HTML code in the appropriate place in your "helpdesk.html" page:


<td rowspan="4" align="left" valign="top">        <font color="#00000">

      <select name="Building" onChange="updateRooms();">

      <option>Albee</option>

      <option>Big Rock</option>

      <option>Brady</option>

      <option>Middle School</option>

      <option>High School</option>

      </select>

      <select name="Room">

      <option value="">Select a Room</option>

     </select>

      <script>updateRooms();</script>

	  </font></td>




You will need to call this page with a URL like this:


http://localhost/FMPro?-db=Helpdesk.fp5&-format=helpdesk.html&-lay=Technicians%20View&-view

All the best.

Garry

This topic is 7409 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.