Question
· Feb 5, 2018

Display selected value from drop down list box

Hi Guys,

I would to know, I have a drop down list items in my applications. While, am clicking on the drop down bx, there are few numbers of listed items, while am doing mouse over action, I should display the entire text of selected item from that drop down list box, even am not selecting that item. I would like to know about the what is exact text it contains in Zen framework. 

If any lead would be appreciated. 

Thank you in advance. 

Discussion (13)2
Log in or sign up to continue

Hi Robert,

Thanks a lot for your help. 

Even, as per your code that works great. I tried like as below, that's also working. 

<dataCombo 
    ......
    title=""  
    onmouseover="zenPage.BtnClick(event.currentTarget);
    />

ClientMethod BtnClick(DTCOMBOAs %String Language = javascript ]
{
    DTCOMBO.title=DTCOMBO.value;
    return;
}

 

Thanks again. 

as all values out of your SQL query come from server you should be able
to setup the content of title on server side as you do for other ZEN components.

#; compopse titel .... into variable mytitle
   set %page.%GetComponentById("Priority").title=mytitle

  


There is  a wide doc on programming ZEN pages
http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GZEN

Hi Steve/Robert,

I have tried like as below.  But, I'm facing an issue as per below attached image. 

Can anyone correct me on this. 

<dataCombo id="Priority1" name="Priority1" label="Priority1" onmouseover="zenPage.BtnClick();"
sql="Select distinct(PriorityName) from User.Sample"/>

ClientMethod BtnClick() As %String [ Language = javascript ]
{
    var DTCOMBO=zenPage.getComponentById('Priority1');
    var MyPriority=DTCOMBO.getValue().toString();
    var result=this.BtnClickMe(MyPriority);
    return;
}

ClassMethod BtnClickMe(MyPriority) [ ZenMethod ]
{
    S %page.%GetComponentById("Priority1").title=MyPriority
}
 

 

Thanks,

Arun Kumar Durairaj. 

Not sure if this is the real problem: Anyhow it is a problem.

   var result=this.BtnClickMe(MyPriority);   // here you expect a return value
    return;
}


ClassMethod BtnClickMe(MyPriority) as %String [ ZenMethod ]     // return something
{
 
  set ^%Arun($i(^%Arun))=$isObject(%page)    // JUST temporary for debugging // check for <INVALID OREF> 
    Set %page.%GetComponentById("Priority1").title=MyPriority
  quit $$$OK      // return something
}

Hi Arun,

If you want a different tooltip (aka 'title' property), for each different item in your dropdown box, then my guess is that, you need to trap the onchange event of the datacombo box.  That is - when the user selects a new item from your dropdown box,  and it fires off an event - add code to that event (onchange?)  which redefines the title property of that datacombo component, based on the selection made.

Of course, somewhere you need to supply to the page a list of title texts that need to be applied for each option in the datacombo box.

Steve

Arun,
#1) the error <INVALID OREFF>  #2) goes away if you use Method BtnClickMe( ...)   instead of  ClassMethod BtnClickMe(....)

#2) setting title property turns out to be tricky since component DataCombo is a complex structure with multiple HTML elements
with multiple title properties.  The ZENmethod  setProperty() reaches only the first one.
Which is the Label (!) and if you didn't declare it in the ZEN class it is hidden and you will never see it.

As a consequence I found this code working:

<dataCombo 
    ......
    title=""  
    onmouseover="zenPage.BtnClick(event.currentTarget);
    />

event.currentTarget gives you the real browser component (<input...>) in hands

ClientMethod BtnClick(DTCOMBO) As %String [ Language = javascript ]
{
    var MyPriority=DTCOMBO.value;
    var result=zenPage.BtnClickMe(MyPriority);
        DTCOMBO.title=result ;
    return;
}

All settings of the page happen in client code. 

/// calculate content of title
/// actually a fake for testing
Method BtnClickMe(MyPriority) As %String [ ZenMethod ]
{
    set ^%Arun($i(^%Arun))=MyPriority
    quit MyPriority_"****"_^%Arun
}

Now as you do not depend on %page object now this could be a ClassMethod as well.