Scott.Atkinson
09-14-2011, 10:56 AM
Hi All,
This is in ASP.Net
Im creating a task loggin system and this allows the user to raise tasks and update them, im using javascript for validation and if the fields are empty it then changes the fields back ground to Red which is fine but then it goes on to update the data in SQL which i dont want, any suggestions or how i can achieve no post back is the result from the function is False (for fields in error)
Html Code where im calling the function
<asp:button runat="server" id="btnChangeCommentsAuth" CSSclass="RaiseButton" OnClientClick="CommentsCheck('MainDisplayContentChange_txtAuthCommentsArea');" PostBackUrl="~/RaiseTaskChange.aspx" Text="Auth" />
Javascript function
function CommentsCheck(comments)
{
var com;
var result = new boolean();
com = document.getElementById(comments);
if (document.getElementById(comments).value == '') {
com.style.backgroundColor = "#B20635";
result = 0;
}
else
{
result = 1
}
}
Thanks in Advance look forward to your reply.
This is in ASP.Net
Im creating a task loggin system and this allows the user to raise tasks and update them, im using javascript for validation and if the fields are empty it then changes the fields back ground to Red which is fine but then it goes on to update the data in SQL which i dont want, any suggestions or how i can achieve no post back is the result from the function is False (for fields in error)
Html Code where im calling the function
<asp:button runat="server" id="btnChangeCommentsAuth" CSSclass="RaiseButton" OnClientClick="CommentsCheck('MainDisplayContentChange_txtAuthCommentsArea');" PostBackUrl="~/RaiseTaskChange.aspx" Text="Auth" />
Javascript function
function CommentsCheck(comments)
{
var com;
var result = new boolean();
com = document.getElementById(comments);
if (document.getElementById(comments).value == '') {
com.style.backgroundColor = "#B20635";
result = 0;
}
else
{
result = 1
}
}
Thanks in Advance look forward to your reply.