Hi All
I have a page in which i using user control .on user control i using
javascript to pop up a message .when i choose wrong date in user
control & submits the page it alerts the message of javascript but
page refrehes. I want to use javascript without page refresh or without
postback .
Is this possible to use javascript without page postback..
Thanks in advance
Vinay
Sym - 31 Aug 2006 19:46 GMT
> Hi All
> I have a page in which i using user control .on user control i using
[quoted text clipped - 5 lines]
> Thanks in advance
> Vinay
You mention control and postbacks, are you producing the page via asp ?
Javascript can validate data on the page, but if anything is to be done
on the server you have to resubmit/postback or use say ajax. Also if
the control is server side and you have a change etc event associated
with it, it will do a postback.
I am not sure i can help more without some html/javascript examples of
your problem tho.
rgds
Symeon.
Sym - 31 Aug 2006 19:46 GMT
> Hi All
> I have a page in which i using user control .on user control i using
[quoted text clipped - 5 lines]
> Thanks in advance
> Vinay
You mention control and postbacks, are you producing the page via
asp.net ?
Javascript can validate data on the page, but if anything is to be done
on the server you have to resubmit/postback or use say ajax. Also if
the control is server side and you have a change etc event associated
with it, it will do a postback.
I am not sure i can help more without some html/javascript examples of
your problem tho.
rgds
Symeon.
web.dev - 31 Aug 2006 20:33 GMT
> Hi All
> I have a page in which i using user control .on user control i using
[quoted text clipped - 5 lines]
> Thanks in advance
> Vinay
Yes. It sounds like you are doing a form validation, however on
invalid entry, you are failing to stop the form submission. In that
case, you can do something like the following:
html:
<form onsubmit = "return validateForm(this)">
...your form elements...
<input type = "text" name = "userdate">
</form>
javascript:
function validateForm(myForm)
{
/*your validation routine
.
.
.
*/
if(myForm.elements["userdate"] == "some_value")
{
return true;
}
return false; //for invalid entry return false, for valid entry
return true
}