0

My javascript doesnt detect my function using Freetextbox..

here's my code in javascript: I don't know if is the right code for Freetextbox.

function validateFreetextbox()
{

    if(document.FTB_API["txt_Decs"].GetHtml == ''  )   
    {
        alert("Please Fill up desciption.");
        return false;
    }
    else
    {
        return true;
    }
}

here's the code in my asp.net/C# button.

 <asp:Button ID="btn_Add" runat="server" OnClick="btn_Add_Click" Text="Add" 

 Width="231px" Font-Size="11px" Font-Bold="false" ForeColor="#333333"  

 onclientclick=" validateFreetextbox()" />
4
  • Don't forget that JavaScript is not C# and brace placement matters Commented Mar 31, 2011 at 10:26
  • In C# brace placement is a matter of style, but in JavaScript is is important to end your function/if statement with a brace, otherwise JavaScript will do it for you, potentially changing the meaning of your code. Commented Mar 31, 2011 at 10:32
  • possible duplicate of javascript function Commented Mar 31, 2011 at 11:08
  • @Muhammad, i only tested only one js function there is no possible of duplication.. Commented Apr 1, 2011 at 0:59

1 Answer 1

2

onclientclick=" validateFreetextbox()" /> should be OnClientClick="return validateFreetextbox()" />

Sign up to request clarification or add additional context in comments.

2 Comments

is the function validateFreetextbox being called?
i tried to put a alert in the start of my function if it's working. And nothing's is happen.. I think my problem is in the asp button?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.