Question

I am new to dashcode and trying to build a simple web app for iphone using it. My primary aim is to have a Rectangular List (I have used the "Rounded rectangle list"). It is a static list and has three rows. What I want is a website to open when user clicks on any of the row, and each row would have a different URL. I was able to add a Rounded rectangle list with three static rows like

The object ID is "list"

Row 1-- Label- "Gift Cards" , Value - "http://www.abcxyz.com/giftcard"

Row 2-- Label- "Toys" , Value - "http://www.abcxyz.com/toys"

Row 3-- Label- "Bikes" , Value - "http://www.abcxyz.com/bikes"

i added onclick even to call a java script function like below

function myButtonPressHandler(event)
{

   var websiteURL = "http://www.abcxyz.com/giftcard";
   location = websiteURL;

}

the above code opens the same URL "http://www.abcxyz.com/giftcard" when the user clicks on any of the three buttons, but what I want is to fetch the value of each child node (which would be their respective URLs) at runtime and open it using location = WebsiteURL something like below (did'nt work for me :( -

function myButtonPressHandler(event)
{

   var websiteURL = document.getElementById("list").children;
   var WebURL = websiteURL[???].value;
   location = WebURL;

}

Any help would be appreciated. Thanks

Was it helpful?

Solution

OK ... so figured out my own answer. The Rounded Rectangular list is actually a multidimensional array. so to get the value of each of the rows i.e. the Http URLs and open them on the browser when the rows were touched/tapped/pressed is as below.

function buttonpresshandler(event)
{
   // Insert Code Here
   var list = document.getElementById("list").object;
   var selectedObjects = list.selectedObjects();      
   //Open webpage with the value of each label
   location = selectedObjects[0][1];
}

Hurray!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top