Form Field Validation Fails
search cancel

Form Field Validation Fails


Article ID: 48739


Updated On:


CA Harvest Software Change Manager - OpenMake Meister



Validation routine fails to work for a field on a form.
I have used both VBscript and Javascript as language but neither works.
When I build the form in Admin tool and enter the validation steps, it works, but when the form is converted and loaded into the database, it does not work.
I want to validate fields as not empty.


The utility formgen.exe does not create the validation section in the .xml file,

The user will have to add that part manually.

The Eclipse plugin uses the .xml file for rendering and validating the form.
The Admin GUI only uses the .hfd file for rendering, so that is why it does not work in Workbench, Eclipse, or Harweb.

Workbench uses Eclipse for rendering the .xml file.

Harweb uses the .html file that is automatically compiled just-in-time (JIT) from the .xml file.
Here is an example of validation code for Eclipse and Harweb.
Update the .xml file with the validation part, then use hformsync utility to put the changes back into the database and then retest in Workbench.

Note: This validation example has been tested successfully.

Example XML file:

<?xml version="1.0" encoding="UTF-8"?> 	
<!DOCTYPE harvest_form SYSTEM "harwebForms.dtd"> 	
<harvest_form numtabs="0" name="Xrs" id="xrs" dbtable="xrs"> 	
<validation language="javascript" client="Eclipse"> 	
if (editor.getTextFieldValue("rfc") == "") 	
{ editor.alert("Please enter a value for RFC"); 	
<validation language="javascript" client="Harweb"> 	
function validate() 	
if (trimAll(document.getElementById('rfc').value) == "") 	
alert("Please enter a value for RFC"); 	
return false; 	
<text-field id="formname" maxsize="128" label="Form Name" dbfield="formname" cols="80"/> 	
<text-field id="rfc" maxsize="40" label="rfc" dbfield="rfc" cols="20" readonly="false"/> 	
<text-field id="blah" maxsize="40" label="blah" dbfield="blah" cols="20" readonly="false"/> 	

Note: Modifying an existing form type with new or changed data fields is very complex. Request help from support or services if you wish to do this. As an alternative you can create a new form type containing your alterations. After running through the normal process to implement your new form in the SCM database, you can adjust the properties of your project's Create Package process to use the new form type as its default instead of the older form type.


Component: HINFST