David,
Put the list of valid field values into a delimited JavaScript string at
the time of JSP page creation. Then use JavaScript to split on the
delimiter, putting it into a JavaScript array (if you have delimiter
issues, escape the values on the JSP side, delimit with a space, then
unescape on the JavaScript side). For field validation, loop through the
entries in the JavaScript array and check.

Eric M. Andersen
I/T Specialist
IBM Global Services
Tel: (781) 895-2637,   Fax : (781) 895-2843, t/line : 362-2637
Internet ID:  [EMAIL PROTECTED]
Lotus Notes ID: Eric M Andersen/Waltham/IBM


David Wall <[EMAIL PROTECTED]>@JAVA.SUN.COM> on 12/15/99 07:21:35 PM

Please respond to David Wall <[EMAIL PROTECTED]>

Sent by:  A mailing list about Java Server Pages specification and
      reference <[EMAIL PROTECTED]>


To:   [EMAIL PROTECTED]
cc:
Subject:  Re: client-side validations with JSP



>     You need to use javascript. Here is a cheesy example:
> THE SCRIPT
> <script>
> function checkFields() {
>  theValue = document.forms[0].whatever.value;
>  if (isNaN(theValue) == true) {
>   alert("Whatever must be numeric!");
>   document.forms[0].whatever.value = "";
>   }
> }


Is there a way to make the Javascript talk with the java beans at the time
of JSP page creation?  That is, suppose my bean has a list of valid values
for a field.  I want the Javascript to check that a field when POSTed is
one
of those valid values.  How do I make the transfer of the information in
the
java bean into an Array or the like in Javascript?

David

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to