For simplicity sake, you don't need AJAX. If you don't need the data
beyond the session, you can simply pass each previously entered item in
hidden fields back to the CGI program each time you call it. Your page
would have a form like this initially:

<form method="post" action="mycgi.pgm">
<input type=text" name="code">
<input type="submit>
</form>

When submit is clicked, your CGI program would return a form that looks
like:
 
<form method="post" action="mycgi.pgm">
<input type=text" name="code">
<input type="submit>
<input type="hidden" name="savedcode" value="first code">
</form>

On the next submit, you'd get:

<form method="post" action="mycgi.pgm">
<input type=text" name="code">
<input type="submit>
<input type="hidden" name="savedcode" value="first code">
<input type="hidden" name="savedcode" value="second code">
</form>

And so on.

You could then find out how many instances of "savedcode" were passed
in, loop through all of them, and do what ever you need to do with those
values. If looking up the extra data is a slow process, you could also
create hidden fields for those items instead of looking them up. You
could also use cookies to do the same thing but some people have an
aversion to them.

One thing to be aware of with using hidden fields (or cookies) is that
it's trivial to change their values. If someone changing a saved field
matters, you would be better off storing all of this on the server.

Matt

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx]
On Behalf Of Wilt, Charles
Sent: Wednesday, April 05, 2006 2:52 PM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] RPG and AJAX was->RE: How do I create a
webpagethat....

Joe,

Good points, however in this case I do want the server to validate the
input and in fact return a few extra fields from the server.

Ajax seems to be a possible solution, or perhaps JSF and Java beans.

Thanks,

Charles Wilt
--
iSeries Systems Administrator / Developer
Mitsubishi Electric Automotive America
ph: 513-573-4343
fax: 513-398-1121
  

> -----Original Message-----
> From: web400-bounces@xxxxxxxxxxxx 
> [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of Joe Pluta
> Sent: Wednesday, April 05, 2006 2:39 PM
> To: 'Web Enabling the AS400 / iSeries'
> Subject: Re: [WEB400] RPG and AJAX was->RE: How do I create a 
> web pagethat....
> 
> AJAX will be the most overused technology for the next 6-12 
> months, until
> people realize that it's just not necessary for the majority of
> applications.  In Charles' case, his initial request was to 
> be able to enter
> items and have them appear on the bottom of the page as he 
> enters each one.
> He didn't say anything about validating the entries, simply 
> keeping track of
> them using a single input field.  This could be done with a 
> very simple fewe
> lines of JavaScript.
> 
> Now, he MIGHT have wanted line by llne validation, but he 
> didn't specify it,
> and yet the immediate answer from some people was to add server-side
> validation via AJAX, without a thought to performance or complexity.
> 
> When you start changing from one web hit for a page to one 
> web hit for every
> field, you're going to find that issues like latency start to 
> become much
> more pronounced.  It's perhaps less of a problem with an Intranet
> application, but if this application is ever meant to go out 
> to slower speed
> connections, then AJAX may not be the idea.
> 
> I'm not against AJAX by any means.  There are applications 
> where it makes
> sense.  The problem is that there are a LOT of issues that 
> need to be dealt
> with, especially when it comes to opening up multiple 
> persistent connections
> to the host. (Oh ho, you say... we don't NEED persistence!  
> Well, if you're
> planning on using any of the capabilities of i5/OS, like 
> library lists and
> security, then you will need persistence of some kind.)
> 
> Anyway, my two cents.  AJAX is a cool technology, but it's 
> not the universal
> panacea, and it's very "coolness" makes it highly susceptible 
> to overuse.
> 
> Joe
> 
> 
> > From: albartell
> > 
> > >Any recommendations on where to start?
> > 
> > If you can wait until the end of the month I have an 
> article coming out in
> > the May issue of iSeries News titled "RPG and Ajax: 
> Together At Last"
> > 
> > It will guide you through the bare bones of AJAX and RPG.  
> The example
> > used
> > in the article is validating an item number and changing 
> the appearance of
> > the page based on the item entered being valid or invalid.
> 
> 
> -- 
> This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
> To post a message email: WEB400@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/web400
> or email: WEB400-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/web400.
> 
> 


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2021 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.