Skip to Content

This Blog explains how to use the addRawText method to achieve client side validation in DynPage.

Introduction:

Client side validation in DynPage can be achieved using the addRawText method. The following link specifies the method addRawText,but code snippets are not provided. This implementation will solve the questions asked in the SDN Forum about addRawText method. Some questions in the SDN forums are as follows.

/message/560891#560891 [original link is broken]

/message/81827#81827 [original link is broken]

I am confident that this blog would solve the questions regarding the usage of JavaScript in DynPage.

How can I do client side validation in DynPage?

If we have an Inputfield and we want to check the value entered by the user is valid (Ex: Should not allow the user to leave the Inputfield blank) or not,then we can use the addRawText method to include JavaScript in a DynPage for performing client side validation.

addRawText: addRawText method adds text without encoding to the container.

How to do it?

The following code checks whether the Input Field is blank,if the Inputfield is blank the JavaScript alerts the user not to leave the Input Field blank.

Code:

DynPage

image
Figure 1 – InputField

image
Figure 2 – Event triggered during ON_BLUR an the message displayed

Hope this blog has explained the usage of addRawText method for Client Side Validation in DynPage using Java Script.

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Martin Sander
    Hi Kirupanand,

    thank you very much for this log. It really helped me to understand client side validation.

    Nowhere else I could find out how to access htmlb elements in javascript. Thanks again. You saved me a lot of time.

    Best regards,

    Martin

    (0) 
  2. Chinthan Yajamaan

    This was very userful. Thank you very much Kirupanand. I was looking for exactly same thing.

    It worked for me with a small modification. I had to add the Javascript code into Doc between the script tags.

     

     

    Document doc = getDocument();

    doc.addRawText(

    “<script language=\”JavaScript\”>function closeWin() { window.close(); }</script>”

    );

    (0) 

Leave a Reply