Validating data before committing

X-Application Version: 4.1.1
Tamino Version : 4.1.1
Platform : Win2k, WinXP, Solaris, Linux, …
WebContainer : Tomcat 4.1.1
JDK Version : 1.4.1, 1.3.1

Is there a way to validate data in an X-Application form before it is submitted? What I’m really wanting is for the application to call a “validate()” function which would return a boolean value as to whether or not the data was valid. The method could put up an “alert” as to the error.


Hi Joel,

by defalut we unfortunately do not support an input validation, but you are able to define your own. Here to alternatives:

1: On the client side
you can insert a javascript fuction which validates the content before submitting, or

2: On the server side
vou are able to write a plugin, which validates the content of the submitted page.
As a result the plugin/new page could redirect to the previous page, when the check failed.

Both alternatives, does have their pros and their cons.

Please let me know, which version you intend to use.


Are there any examples available on how to do the client side validations as mentioned in the previous post. I know how to do this in ‘normal’ HTML but am unsure how to implement it together with xapplication’s LUW. The submit() of the xapplication is quite complex.

Elsabe Jacobs

Hi Elsabe,

here just a simple example. I have modified the Search.jsp of our Property example that way,
that a small function is testing if the entered value of bedrooms is a number or not:

First I entered a mall amount of javascript code a the top of the page:

<SCRIPT language=Javascript>
function IsNumeric(sText)
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

   for (i = 0; i < sText.length && IsNumber == true; i++) 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         IsNumber = false;
   return IsNumber;

function mySubmit(){
	if (document.form1.valNoBRFrom.value!="" && "true" == IsNumeric(document.form1.valNoBRFrom.value)){
		alert("'From' is not a number!");
		return false;
	if (document.form1.valNoBRTo.value!="" && "true" == IsNumeric(document.form1.valNoBRTo.value)){
		alert("'To' is not number!");
		return false;
	return true;
</pre><BR>IsNumeric tests an entered value on numbers and mySubmit does the submit of the form.<BR><BR>Afterwards I have changed the direct submit in the anchor the my own function:<BR>   <B>previous:</B><BR>   <pre class="ip-ubbcode-code-pre">
        <a href="javascript:document.forms['form1'].submit();">
   </pre><BR>   <B>modifed:</B><BR>   <pre class="ip-ubbcode-code-pre">
        <a href="javascript:mySubmit();">

Thats all.
I hope this information will help you.

Search.jsp (16 KB)

Thank you very much for this. The trick was to make this work for Modify and Create (which is really where you want to do client side validations. I managed it with the following changes to the mySubmit() function:

function mySubmit(){
if (IsNumeric(document.form1.item('#OrganisationDocument#/Organisation/OrganisationID').value) == false ){
		alert("'Organisation ID' is not a number!");
	else {
	return true; }


so the value passed in the item() being the name as xapplication generates it.

Thanks again
modify.jsp (20.2 KB)