Skip to Content
avatar image
Former Member

Validation

Hi all,

How would i go about to able to use a javascript for validation of an inputField for example. I have tried som examples from the PDK, but i am not able to resolve it. If anyone could give me a short example of an jsp file it would be greatly appreciated....

Best Regards,

Max

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Feb 18, 2004 at 05:08 PM

    Hi Max,

    Following is the jsp file.

    <%

    String strValue;

    %>

    <hbj:content id="myContext">

    <hbj:page title="title" >

    <hbj:form id="form">

    <hbj:inputField

    id="txtValue"

    type="STRING"

    maxlength="10"

    value=""

    width="100"

    design="STANDARD"

    >

    <%

    strValue=myContext.getParamIdForComponent(txtValue);

    %>

    </hbj:inputField>

    <hbj:button

    id="button"

    text="Validate"

    onClientClick="callMe()"

    >

    </hbj:button>

    </hbj:form>

    <SCRIPT LANGUAGE="Javascript">

    function callMe()

    {

    alert("Inside javascript function.Value is ="+document.getElementById('<%=strValue%>').value);

    }

    </SCRIPT>

    </hbj:page>

    </hbj:content>

    Add comment
    10|10000 characters needed characters exceeded