Skip to Content
avatar image
Former Member

How to display error messages in bsp page

hi

I have a requirement to display error message in bsp page. iam typing a wrong value in the input field and for that input field a check is performed in oninputprocessing event handler. based on that check i need an error message to be displayed on the same page alerting the user to enter correct value.

Thanks and regards

Vineetha

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    May 17, 2007 at 11:12 AM

    Hi,

    If you are talking about validating the input like checking if it is a Numeric value or not or something like that, you can also do it on the Client side using Javascript functions....

    For eg. if you want to check for numeric value then use the following code :

    <script language = "JavaScript">
    
    function validate()
    {
        if( null == document.Form1.inputField_ID.value || "" == document.Form1.inputField_ID.value || !allDigits(document.Form1.inputField_ID.value))
        {
            alert ("Your alert message here...!");
            return false;
    
        }
       return true;
    }
    
    function allDigits(str)
    {
       return inValidCharSet(str,"0123456789");
    }
    
    function inValidCharSet(str,charset)
    {
       var result = true;
       var count = 0;
       var str_len = str.length;
       var index = str.indexOf(".");
       for (var i=0;i<str_len;i++)
       {
          if (charset.indexOf(str.substr(i,1))<0)
          {
    	  result = false;
    	  break;
          }
       }
       return result;
    }
    </script>
         <htmlb:inputField id        = "InputField_Id"
                           maxlength = "10"/>
    
         <htmlb:button id      = "Test"
                       text    = "Test ClientClick"
                       onClientClick = "if (!validate()){htmlbevent.cancelSubmit=true;}" />
    

    Then you can custom your error messages using alert statement...!

    Hope this helps...

    <i>Do reward each useful answer..!</i>

    Thanks,

    Tatvagna.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 18, 2007 at 04:02 AM

    Hi,

    If youer issue is resolved please Reply/Reward and Close this thread...!

    Thanks,

    Tatvagna Shah.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Vineetha,

      Just to remaind you again, If your problem is solved with any of these solutions, Please reward the points and close the thread.

      Regards

      Geogyu

  • avatar image
    Former Member
    May 17, 2007 at 11:17 AM

    Hi,

    Please do the following

    embed the following tag in your layout

    <i> <phtmlb:messageBar id = "messageBar"

    type = "<%= gv_severity_str %>"

    text = "<%= gv_message %>"/></i>

    In oninputprocessing event handler

    <i>If INPUT IS WRONG

    MESSAGE eXXX(/MESSAGECLASS) INTO gv_message. "or gv_message = 'An Error Occured'

    gv_severity_str = 'ERROR'.

    return.

    ENDIF</i>

    Regards

    Geogy

    PS: Please reward points if answer is usefull

    Add comment
    10|10000 characters needed characters exceeded