jQuery clear text

jQuery clear text

  

Hi, am having some trouble in jQuery. How do I remove the text that I added after the input box?


Here's my code:

SyntaxEditor Code Snippet


function CheckValidation()
{
     if($('#"+Employee_Address.Id+":text').val() == '') 
            {

      $('#"+Employee_Address.Id+":text').after('<span style="" position: absolute; border: 1px solid red; font-size:larger; background-color: lightcoral; color: whitesmoke;  margin-left: -1px; "">Please enter the address</span>') ;  
 
 $('#"+Employee_Address.Id+":text').css('border-color', 'red');                
}
      else
        {      
                $('#<span>').text('');
                  $('#"+Employee_Address.Id+"').css( 'border-color', 'gray' ); // this will change the color of input field
                   
                  return false;
} };

The highlighted text is the one I used to remove the span I created near the input field. 


Please help me. If you want to see the oml. I have attached it too.

why don't you use the simple client-server validation of outsystems?


J. wrote:

why don't you use the simple client-server validation of outsystems?


Yeah.. But I need to learn How the JavaScripts and jQuery are used in Outsystems. So I have been asked to do the client side validation using javascript and jquery. 


Implementing the Javascripts directly in html is different from implementing in Outsystems. So please help me.


Hi Sathish,

I have done some changes in your code & now for first control EmployeeName I have implemented jquery code in onkeyup event if you do not write anything then it will be red and if you write something it will be green in this way you can understand how we can use jquery in outsystems.

Case 1: If call onkeyup event with blank textbox.

Case 2: If call onkeyup event with filled textbox.



I think it should be helpfull to learn use of jquery in outsystems.

Regards

SK



Sahshi kant Shukla wrote:

Hi Sathish,

I have done some changes in your code & now for first control EmployeeName I have implemented jquery code in onkeyup event if you do not write anything then it will be red and if you write something it will be green in this way you can understand how we can use jquery in outsystems.

Case 1: If call onkeyup event with blank textbox.

Case 2: If call onkeyup event with filled textbox.



I think it should be helpfull to learn use of jquery in outsystems.

Regards

SK



Yeah I understand. But the problem is, even after I enter the name the error message still in display. I want it to disappear after the input box is filled.


So please help me to achieve this.


Thanks 

Sathish.D

Sathish,

You can see javascript function which is attached with page and alter this javascript function as per your requirement.

Actually i didnt corrected the javascript function i have demonstrated how can we use javascript/jquery with outsystem I hope this can help you to understanding to using Javascript in outsyatems.

Regards

SK

Sahshi kant Shukla wrote:

Sathish,

You can see javascript function which is attached with page and alter this javascript function as per your requirement.

Actually i didnt corrected the javascript function i have demonstrated how can we use javascript/jquery with outsystem I hope this can help you to understanding to using Javascript in outsyatems.

Regards

SK

Okay Thanks. I will check.