Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Javascript Error

Javascript Error

Scheduled Pinned Locked Moved ASP.NET
helpjavascriptsysadmin
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    M_Menon
    wrote on last edited by
    #1

    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

    M P 2 Replies Last reply
    0
    • M M_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

      M Offline
      M Offline
      Michael Sync
      wrote on last edited by
      #2

      You should add return in onclick event. For example : onclick="**return** ValidateDates();"

      Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)

      M M 2 Replies Last reply
      0
      • M Michael Sync

        You should add return in onclick event. For example : onclick="**return** ValidateDates();"

        Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)

        M Offline
        M Offline
        M_Menon
        wrote on last edited by
        #3

        Thank you very much Micheal, It worked fine for me.. Thanks

        Cheers Menon

        1 Reply Last reply
        0
        • M Michael Sync

          You should add return in onclick event. For example : onclick="**return** ValidateDates();"

          Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)

          M Offline
          M Offline
          Michael Sync
          wrote on last edited by
          #4

          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)

          1 Reply Last reply
          0
          • M M_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

            P Offline
            P Offline
            Pushpendra patwal
            wrote on last edited by
            #5

            Mec ... is korrect :) Use return where you have called the event

            P.S.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups