Avatar

Correct answer by
Level 10

Hi Graham

If you are willing to change your text fields so they have the same name there are then a number of ways you can refer to them as a group, so if your subform containing the buttons and text fields was called SubForm and the text fields were all called TextField then then "SubForm.TextField.all" will return a list of all the text fields.

Then if you have a function like;

function set(subForm, index)
{
var textFields = subForm.TextField.all;
for (i = 0; i < textFields.length; i++)
{
  if (textFields.item(i).index == index)
  {
   textFields.item(i).presence = "visible";
  }
  else
  {
   textFields.item(i).presence = "invisible";
  }
}
}

And in each button click call the function with;

set(SubForm, this.index);

The function will make visible the text field that has the same index as the button that was clicked.

Bruce

View solution in original post