Register to post in forums, or Log in to your existing account
 

This forum is locked: you cannot post, reply to, or edit topics.  This topic is locked: you cannot edit posts or make replies.     Home » Forums » General zApp Discussion
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Nov 15, 2004 11:30 pm   

Yet another COOL feature in zApp...HTML Forms
 
As everyone knows, whenever I'm sick I always seem to come up with nifty new ideas. Well, it seems to still work with zApp.

I was thinking about the new net library in zApp that provides all of the URL, HTTP GET, POST, etc functions. I've always been annoyed at how complicated some network libraries are. I like some of the simplicity of the PHP curl extension, but it is even too complicated with all of its SETOPT routines. I want zApp to allow you to easily access web resources.

As I was writing, it occured to me that I could make HTML forms really easy. After all, what is a form anyway but a group of controls that you want to send data from. On an HTML web page, a form is a rectangular area on the screen that contains various controls. Well, we have that already in zApp...it's called a zPanel.

So, I have added a simple extension to a Panel and a new Kind of Button. Take a look at this example of a typical zApp window:

Code:
<WINDOW Name="FormDemo">
  <PANEL URL="http://www.hostname.com/script.php">
    <EDIT Name="Username" Caption="Username:" Align="top"/>
    <EDIT Name="Password" Caption="Password:" Align="top"/>
    <VAR Name="Hidden" Value="MyData"/>
    <PANEL Height=22 Align="bottom">
      <BUTTON Name="Submit" Caption="Submit" Align="center" Action="_Submit"/>
    </PANEL>
    <MEMO Name="Comments" Align="client"/>
  </PANEL>
</WINDOW>


OK, this creates a window with two edit boxes, named Username and Password, then a button centered at the bottom called "Submit" and a big memo field filling the rest of the form.

Take a look at the main <PANEL>. See the URL field? OK, now look at the Submit button...see the Action="_Submit" property? When you click this button it executes the built-in _Submit action, which causes zApp to look in the parent panels until it comes to one with the URL property set. It will then take all of the data in all of the controls within this panel and any subpanels and package it all into an HTTP POST request.

The <VAR> object is used to set hidden data that is sent as part of the POST request, but is not seen on the form.

Cool, huh? Cool This lets you interact with the web and create web post forms within your application, just as easy as adding the URL property to a panel and adding a submit button.

I don't know of any other language that makes it this easy. Certainly not Delphi or Visual Basic, or Visual Studio, or even .NET for that matter.
Reply with quote
Rainchild
Wizard


Joined: 10 Oct 2000
Posts: 1551
Location: Australia

PostPosted: Tue Nov 16, 2004 12:55 am   
 
Does that follow the same syntax as the HTML forms? I can't remember off the top of my head, it looks similar though.

You probably need some way to specify between GET and POST requests? or will POST only be supported at this time?

Looks pretty nifty tho :)
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Nov 16, 2004 1:22 am   
 
Not quite. The things like <EDIT> are standard zApp objects and there is no attempt to make these the same as the HTML Form tags. For example, I think in HTML they are <INPUT> tags and you have stuff like "TEXTAREA" instead of <MEMO> and stuff like that. You'll be able to put any zApp control in a form and zApp will try to convert each control to the appropriate HTML syntax that most closely matches the component type.

As far as Get vs Post, there will certainly be a property you can set to change that, but the default is POST. Once again, I want the default to always try to do the right thing and these days, a huge percentage of forms are POST rather than GET.

Of course, the actual usefulness of this feature in "real life" is a bit limited because in most cases (like posting to this forum, for example) the server is using session control to prevent abuse and you cannot just post to a URL like this. So, this doesn't work in secure applications, but in non-secure cases it will work fine and might be useful to someone.
Reply with quote
slicertool
Magician


Joined: 09 Oct 2003
Posts: 459
Location: USA

PostPosted: Fri Nov 19, 2004 11:46 pm   
 
Shouldn't there be an actual password control? There are many places where it would be good for zApp to hide the password you're entering. Otherwise it looks great and I can think of several uses for it.
_________________
Ichthus on SWmud: http://www.swmud.org/
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Sat Nov 20, 2004 12:26 am   
 
The <EDIT> control has a property called "PasswordCh" that you can set to whatever character you want echoed in place of what the user types. For example, setting this property to "*" is a typical way to get a password control. You don't need a separate control.

In zApp, I'm trying to keep the number of controls relatively small and control variances with property values. So, there is one Editbox, one Combobox, one Memo control, etc. Rather than having separate TextMemo, RTFMemo, HTMLMemo, for example, like some languages do.
Reply with quote
slicertool
Magician


Joined: 09 Oct 2003
Posts: 459
Location: USA

PostPosted: Tue Jan 25, 2005 9:36 pm   
 
I'm trying to set the PasswordCh property in the latest release of zapp, but seem to be failing miserably

<edit name='Edit2' PasswordCh='*' align='top'/>

either I'm very slow on the uptake (I'm probably doing it wrong) or it isn't implemented in this version.
_________________
Ichthus on SWmud: http://www.swmud.org/
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Jan 25, 2005 10:16 pm   
 
The property is actually called "PasswordChar".

Keep in mind that some of these forum posts are old and that things can change in the actual release. Always check the documentation for the most up-to-date information. If you go to the zApp Manual and then into Object Reference and then select Edit you will see a list of properties on the left. While each property doesn't have detailed documentation yet, it at least shows what properties are available and what their correct spelling is.
Reply with quote
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Home » Forums » General zApp Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
© 2009 Zugg Software. Hosted on Wolfpaw.net