RJ I think you are messing everything.
When you write "<csp:if condition='(objTlphone.%ID)"
you should write "<csp:if condition='(objTlphone.%Id())"

When you want to select an element from a dropdown it's easy:
Let's supose your field name is "Telephone" populated with a query that sends ID and NUMBER.
From your previous Page you just send "NextPage.csp?Telephone='24'" where 24 is the ID of your query. Even if the drop down is populated the value that has 24 as ID will get selected.


When you refer to a Query you can use ID, if you refer to an object you should refer to %Id().

I've write a routine to filter a dropdown with a query:
TagFilter(tagname,query)
        w "document.form."_tagname_".length=0;"
        Set result=##class(%ResultSet).%New()
        // "SELECT ID, Name FROM Package.Class WHERE <Where Clause>"
        Do result.Prepare(query)
        Do result.Execute()
        Set i=0
        while(result.Next()) {
          Write "document.form."_tagname_".options[",i,"] =",
            "new Option('",$Get(result.GetData(2)),"','",
            $Get(result.GetData(1)),"');",!
          set i = i+1
        }
     Do result.Close()
    Quit ""

I think this can help you.
Nuno
RJH wrote:

I guess that in your example you always check for 0 what if you don't know?
I mean, suppose you have fill the drop down from a table with a query, but
you don't know what the current record holds. So I'm trying to check for
whatever is in the table. First I get the record like so,

  if $D(%session.Data("sTlphone"))
  {
   Set objTlphone =
##class(pkgAddressBook.cTlphones).%OpenId(%session.Data("sTlphone"))
  }
  else
  {
   Set objTlphone =
##class(pkgAddressBook.cTlphones).%OpenId((%request.Get("tlphoneID")))
  }

then I try to check a value against a query named nTlphoneTypes like this

<csp:if condition='(objTlphone.%ID)=nTlphoneTypes.Get("ID")'>

The if does not like the object...

"Nuno Canas" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

I call a page like CustomerList.csp?HEADER=0
In CustomerList.csp I have the CSP:if tag.
If HEADER variable is not 0 I include the header page (Topo.csp) else I
do nothing.

This works for me.
What are you trying to do ?
Where does nTlphoneTypes comes from? Is it the form name ?

Why don't you try to get the $l(%request.Get("tlphoneID"))

Nuno

RJH wrote:


If you try to put your 0 value in a variable or try to retrieve it from
another page, that's when I run into trouble...

"Nuno Canas" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]


Yes it works !!!
I use this code several times in my application .


<csp:if condition='%request.Get("HEADER")=0'> <!-- Do Nothing --> <csp:else> <csp:include Page="../Topo.csp"> </csp:if>

Nuno

RJH wrote:


Can someone tell me why the %request.data or %request.get does not work

when


using an if in csp? can you provide the correct syntax?

<csp:if

condition='nTlphoneTypes.Get("ID")=%request.Data("tlphoneID",1)'>








Reply via email to