Change labels based on listbox selection

 2 Replies
 0 Subscribed to this topic
 12 Subscribed to this forum
Sort:
Author
Messages
Bakerstreet
New Member
Posts: 2
New Member
Hello all. I am new to Lawson Design Studio. I am trying to create a javascript that will change the labels on a form based on the item the user selects from a listbox.

Here is what I have tried to do:

function select1_onChange()
{
    if (lawForm.getFormValue("select1") == "P")
   {
     lawForm.setFormValue("label14", "Account Number");
   }
 if (lawForm.getFormValue("select1") == "R")
 {
  lawForm.setFormValue("label14", "City or Address 5");
 }
}

This does not work. It does not seem to get into the function even. I tried removing all the code from the function and just put an alert in there, but it would not alert when I selected different options in the list box. I assume I have to tie this function to the listbox somehow, but I do not know how.

Thank you!  

Ragu Raghavan
Veteran Member
Posts: 477
Veteran Member
I think the event you want is VALUES_OnBlur or Values_OnFocus. Within that based on the list ID, call the appropraite function.
Bakerstreet
New Member
Posts: 2
New Member
That worked like magic! I inserted this function:

function VALUES_OnFocus(id, row)
{
select1_onChange()
}

And now when I click on the listbox and change its value the labels I want changed change. Thank you so much for your help!