Javascript Error
-
Hi Friends, I am using two method onclick of my button. OnClientClick="ValidateDates() (Client Side Validation Method) function ValidateDates() { //Get both datesvar startDate = eo_GetObject("OpenDatePicker").getSelectedDate(); var startDate = eo_GetObject("ArrivalDatePicker").getSelectedDate() ; var endDate = eo_GetObject("DepartureDatePicker").getSelectedDate() ; //Check if both dates are provided if ((startDate == null) || (endDate == null)) { alert("Please enter both Arrival and Departure dates."); return false; } if (startDate.valueOf() > endDate.valueOf()) { alert("The Arrival date must be before the Departure date."); return false; } } OnClick="addItinerary" Server Side Method Now i am getting Alert on the Condition But my Server side Method is also being called at same time. I want it to return when it Gets alert on Client side Validation. Any suggestions or help would be highly appreciated Thanks Menon
Cheers Menon
-
Hi Friends, I am using two method onclick of my button. OnClientClick="ValidateDates() (Client Side Validation Method) function ValidateDates() { //Get both datesvar startDate = eo_GetObject("OpenDatePicker").getSelectedDate(); var startDate = eo_GetObject("ArrivalDatePicker").getSelectedDate() ; var endDate = eo_GetObject("DepartureDatePicker").getSelectedDate() ; //Check if both dates are provided if ((startDate == null) || (endDate == null)) { alert("Please enter both Arrival and Departure dates."); return false; } if (startDate.valueOf() > endDate.valueOf()) { alert("The Arrival date must be before the Departure date."); return false; } } OnClick="addItinerary" Server Side Method Now i am getting Alert on the Condition But my Server side Method is also being called at same time. I want it to return when it Gets alert on Client side Validation. Any suggestions or help would be highly appreciated Thanks Menon
Cheers Menon
You should add
return
in onclick event. For example :onclick="**return** ValidateDates();"
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)
-
You should add
return
in onclick event. For example :onclick="**return** ValidateDates();"
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)
-
You should add
return
in onclick event. For example :onclick="**return** ValidateDates();"
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)
I'm really wondering who did this.. 1) no matter whether it's easy or not. It solved other people's problem. 2) It's already 1:10 AM in my country but i'm still reading this forum... but some people voted down my post... Can you please tell me what wrong with my post? Thanks.
Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)
-
Hi Friends, I am using two method onclick of my button. OnClientClick="ValidateDates() (Client Side Validation Method) function ValidateDates() { //Get both datesvar startDate = eo_GetObject("OpenDatePicker").getSelectedDate(); var startDate = eo_GetObject("ArrivalDatePicker").getSelectedDate() ; var endDate = eo_GetObject("DepartureDatePicker").getSelectedDate() ; //Check if both dates are provided if ((startDate == null) || (endDate == null)) { alert("Please enter both Arrival and Departure dates."); return false; } if (startDate.valueOf() > endDate.valueOf()) { alert("The Arrival date must be before the Departure date."); return false; } } OnClick="addItinerary" Server Side Method Now i am getting Alert on the Condition But my Server side Method is also being called at same time. I want it to return when it Gets alert on Client side Validation. Any suggestions or help would be highly appreciated Thanks Menon
Cheers Menon
Mec ... is korrect :) Use return where you have called the event
P.S.