It needs to be a handler, not a method ..

 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paulo Scardine
Sent: Tuesday, 22 May 2007 1:56 PM
To: Laszlo Users
Subject: [Laszlo-user] Question about "ondata" event

 

I'm a little lost here...

I made a login form containing a dataset and a datapointer (laszlo 4.0.x on
Ubuntu):

<canvas>
<dataset name="login_query" src= <http://localhost/login_query.php>
"http://localhost/login_query.php"; request="true" type="http" />
<view>
<simplelayout axis="y" />
<edittext id="edtLogin" text="login"/>
<edittext id="edtPass" text="password" password="true"/>
<button x="25" width="165" id="btnLogin" text="Send">
  <handler name="onclick">
    var d=canvas.datasets.login_query;
    var p=new LzParam();
    p.addValue("login", edtLogin.getText(), true);
    p.addValue("password", edtPass.getText(), true);
    Debug.write("Login: " + edtLogin.getText() + ", Password: " +
edtPass.getText() );
    d.setQueryType('POST');
    d.setQueryString(p);
    d.doRequest();
  </handler>
</button>
<datapointer id="dp_login" xpath="login_query:/">
   <method name="ondata">
     if (this.xpathQuery('result/text()') == 'OK') {
       Debug.write("Operation succeeded");
     } else {
       Debug.write("Operation failed");
     }
   </method>
</datapointer>
</view>
</canvas>

The login_query.php application returns <result>OK</result> or
<result>ERROR</result>.

Why "ondata" is not triggered  when d.doRequest() is called? 

If I inspect the value with debugger it's changing! 

lzx> dp_login.xpathQuery('result/text()') 
'OK' 
lzx> dp_login.xpathQuery('result/text()') 
'ERROR' 

What is wrong? This is driving me crazy for two days.

Thanks in advance,
--
Paulo

Reply via email to