Hi All, I am very confusion about the following question: dtml-if to test an integer and string. Two sql methods: 1) testPassword select pd from reader where <dtml-sqltest name op=eq type=string > 2) getID (This parameter (pID) is an integer, if signed reader, pID = 1, if not signed, pID = 0) select pID from reader where <dtml-sqltest name op=eq type=string > Form: <form name="Form" method="GET" action="TestpID"> <font face="Arial, Helvetica, Geneva" size=-1>ID:</font> <input name=name size=20 maxlength=32> <br><font face="Arial, Helvetica, Geneva" size=-1>Password:</font> <input name=pd size=20 maxlength=32> <br><font face="Arial, Helvetica, Geneva" size=4> <input type=submit value="Test"> </form> Dtml method: 1)TestpID <dtml-try> <dtml-if "pd == testPassword(name=_['name'])"> Work now <dtml-else> not works </dtml-if> </dtml-try> Problem is: I always get the "not works" result. 2)1)TestpID <dtml-try> <dtml-if "getID(name=_['name']) == 1"> Work now <dtml-else> not works </dtml-if> </dtml-try> Problem is: I always get the "not works" result, Even I test zsql method is right. Many thanks for any of your advice. Yan __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com
On Tue, 2003-07-15 at 12:56, yan zhang wrote:
Dtml method:
1)TestpID
<dtml-try> <dtml-if "pd == testPassword(name=_['name'])"> Work now <dtml-else> not works </dtml-if> </dtml-try>
Problem is: I always get the "not works" result.
First thing I'd suspect is that testPassword is returning a 1 (integer) and pd is set to '1' (string). Those are not equivalent, of course. :-) If that's not it, you may want to inspect the pieces of this comparison: -- Start TespID dump -- pd: <dtml-var pd> name: <dtml-var name> _['name']: <dtml-var "_['name']) testPassword: <dtml-var "testPassword(name=_['name'])"> -- End TespID dump -- That's crude, but it's a pretty easy way to see what's going wrong. HTH, Dylan
participants (2)
-
Dylan Reinhardt -
yan zhang