Skip to Content
0
Former Member
Jul 05, 2006 at 12:07 PM

User input validation using Client Eventing

15 Views

Iam developing a portal application using JSPDynpage. I need to validate a user input. I have set the input field in the jsp page as follows,

<hbj:inputField

id="custID"

type="string"

maxlength="25"

jsObjectNeeded="true">

<% custID.setClientEvent(EventTrigger.ON_CHANGE,"validate()"); %>

</hbj:inputField>

In the Javascript function,Im trying to validate a null input, as follows.

function validate(){

var funcName=htmlb_formid+"_getHtmlbElementId";

func=window[funcName];

var inputfield=eval(func("custID"));

if(inputfield){

var value=inputfield.getValue();

if(value=="")

alert("Please enter a value");

}

}

When I do this I get an error message, error in rendering jsp component.

Can anyone suggest a solution,PLEASE?

I promise to reward points 😊

Regards,

Saraswathi