PDA

View Full Version : Validate a field in eRPG/CGI programming



vrozen1
11-02-2001, 05:54 AM
Michael, there is some scenarios in your CGI. 1 - all fields valid and CGI completes required action and build next screen for a user. 2 - Some values are invalid. The CGI builds your first screen (one with a form) and add error text at the bottom. 3-Same as 2, but you add extra input hidden field into a form. Then CGI builds in JavaScript that display alert. This is how it could be: .... form onSubmit="return Validate(this)" ACTION="http://186.167.34.56:8080/cgi/FrmMaint" METHOD="POST" NAME="ADDUPDGRP" .... Input type="HIDDEN" name="ERROR" value="Customer is invalid." SCRIPT if (document.ADDUPDGRP.ERROR != null){ alert(document.ADDUPDGRP.ERROR.value); } /SCRIPT /form Of course, it is better to have 3-tier application rather than CGI. That will give you possibility to redirect response to your initial html instead of build it in CGI. Well, it will be interesting, if somebody know how to redirect in RPG/CGI.

Guest.Visitor
11-02-2001, 06:00 AM
I know I've asked this question before, but I'm still in the dark about it. How would I validate say a customer number field on a web browser form? I know how to validate simple fields with java script, that don't necessarily need 400 data to check against. I do know how to post and get data from the form and bring it into my program or database. But I'm totally clueless as to how to check and field and display it on the same page like some of the guys on this forum do. Like we do on a regular green screen. Thanks in advance.