Validating User Input
Posted in 1999
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL
Hi all!! I have a problem in infromix-4gl Version 6.0. I have to check the userinput if it includes specific german letters and display a comment like "check your input". I tried with INCLUDE command in the form like this. f000 = table.name, INCLUDE = ("*special letter*"); But the matchcode doesn't work. thanx for any help Matthias Meyerhoefer
Its been a while ( he says, dusting off his 4gl memories !! ) but... If you use the INCLUDE clause, doesn't this incidcate to the FORM the values that are permitted and NOT what values that can be included as part of the input field ? i.e. If you said INCLUDE ("S") this would only accept values of "S" rather than "Stephen" or "Sugar" or "The Simpsons" Again, I'm not totally convinced of this as I don't have a development system to play on at the moment. Sean Matthias Meyerh'fer wrote in message <7847fl$knm$1@news.online.de>... >Hi all!! > >I have a problem in infromix-4gl Version 6.0. >I have to check the userinput if it includes specific german letters and >display a comment like "check your input". >I tried with INCLUDE command in the form like this. > >f000 = table.name, INCLUDE = ("*special letter*"); > >But the matchcode doesn't work. > >thanx for any help >Matthias Meyerhoefer > >
Matthias Meyerhöfer wrote: > > Hi all!! > > I have a problem in infromix-4gl Version 6.0. > I have to check the userinput if it includes specific german letters and > display a comment like "check your input". > I tried with INCLUDE command in the form like this. > > f000 = table.name, INCLUDE = ("*special letter*"); > > But the matchcode doesn't work. > > thanx for any help > Matthias Meyerhoefer Extracting from the manual: (The value is the "*special letter*" part of the INCLUDE.) "Each value is a restricted expression that cannot include the name of any 4GL variable nor programmer-defined function. It can include literal values, built-in functions and operators (page 4-11), and the constants TRUE and FALSE. The same rules for DEFAULT attribute values (page 5-38) also apply to INCLUDE values. TEXT fields and BYTE fields cannot have this attribute. "If a field has the INCLUDE attribute, the user must enter an acceptable value (from the value list) before INFORMIX-4GL accepts a new row. If the value list does not include the default value, then the INCLUDE attribute behaves like the REQUIRED attribute, and an acceptable entry is required. Include the NULL keyword in the value list to specify that it is acceptable for the user to press the ENTER key without entering any value. f006 = survey.item06, INCLUDE = (NULL, "YES", "NO"); "In this example, the NULL keyword allows the user to enter nothing. You can-not specify this by substituting a string of blanks for the NULL keyword here, since a NULL character value is different from ASCII 32, the blank character. "Including a COMMENTS attribute to describe acceptable values makes data entry easier, since you can display a message to advise the user of whatever restrictions you have imposed on data entry:" I think this answers the question: INCLUDE tests for whole fields, not individual letters in the field. You will need a programmatic check in the 4GL code, perhaps using a MATCHES clause: IF (myfield MATCHES "*[sso:u:]*") THEN ... (where ss o: and u: are my representations of some German characters). -- Peter Lancashire Information Systems Specialist, Bayer plc Eastern Way, Bury St Edmunds, Suffolk, IP32 7AH, UK Tel: +44-1635-562258, Fax: +44-1635-562281 -- If all else fails, read the instructions and the release notes. Join Infuse, the UK Informix User Group at http://www.infuse.org.uk/