View Full Version : Easy example server side editing.
explorer
03-21-2006, 10:04 AM
Can someone tell me where there is an example of a simple server side editing example in LZX?
I would have bet anything I saw a simple example in the documentation of a user logon screen where the lzx had user name and password that was submitted to a server side ("jsp" I think) program that would return back a simple passed or failed message. I look through the documentation and I can not find it?
I just would like to see an simple example of server side editing, any help would be great.
Thanks.
jstretch
03-21-2006, 10:14 AM
<dataset name="login" type="http" />
<script>
login.setSrc("login.jsp?user=joe&pass=pword");
login.doRequest();
Debug.write(login.serialize());
</script>
http://www.laszlosystems.com/lps-3.1.1/docs/guide/data_app.html#d0e21434
explorer
03-21-2006, 10:56 AM
Wow, that was a quick response.
Thanks for the code snipplet and the link to the documentation. I knew I had seen that example somewhere.
So, here is the final question to round out this thread. Is this the recommended (I know that word geneartes a lot of "if"s and "but"s) way to edit a simple form and then return error's to LZX. If I were to mock up a simple LZX form with name, street address, city, and zip code. I then posted that to a servlet/JSP to edit/update the page and upon recieving that information the servlet/JSP edited the data items and after checking against a database realized that the city and zip code were invalid. Would I then somehow return a message in the servlet/jsp that said 'City invalid' and 'Zip Invalid'. I would quess the LZX form could then display that message or send them on to the next form page (if that is what I was trying to do).
I apologize because I know this has been asked before but after searching the forums I could not find a simple example or the questions the closely matched mine never got responsed to (maybe because the answer is so darn obvious to everyone but me and the orginal posters).
Thanks again jstretch for your quick response to my first message.
jstretch
03-21-2006, 11:04 AM
no prob.
Yes, for a simple contact form the JSP would do the validation and generate an XML response:
<root>
<response>success</response>
</root>
Then laszlo would have a view to display the message:
<view datapath="login:/root/message">
<method event="ondata">
if(this.datapath.xpathQuery('text()') == "success")
msg.setAttribute("text", "Your data was sent!");
else
msg.setAttribute("text", "Request failed. Try again.");
</method>
<text name="msg" resize="true" />
</view>
explorer
03-21-2006, 01:18 PM
That is what I was looking for. Thanks a lot. I can not wait to dive in and see what I can do.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.