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. 

  • 0
  • 154
  • 11
  • 2

Answers

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.

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. 

Congratulations! yes
The call to server is only necessary if you provide some tricky calculations at server side

ZEN component  <datacombo has a parameter title  which is displayed on mouseover event of the browser

example out of SAMPLES/Class ZENApp.HelpDesk 

<dataCombo id="Priority" name="Priority" label="Priority" title="RoberT"

Hi Robert,

 

If I have multiple values in datacombo box using by SQL queries, I should display each values as per my selection of the text. 

 

Can you please advise on this. 

 

Thanks. 

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

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 Robert,

I tried the above. But, Still am facing an issue like below. 

Globlal:

zw ^%ARUNDTMP
^%ARUNDTMP("|TCP|1974|10844")=0
^%ARUNDTMP("|TCP|1974|26688")=0
 

#1) your subscript is just $i not $i(^%ARUNDTMP)  so we loose the full trace for multiple calls.
       but we have anyhow some trace.

#2) $isObject(%page)  = 0
      so there is NO object of your ZENpage available and access to %page.... must fail.

Hard to say why and where you loose %page