This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes JQuery Slider Issue in Value Resetting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "JQuery Slider Issue in Value Resetting" Watch "JQuery Slider Issue in Value Resetting" New topic
Author

JQuery Slider Issue in Value Resetting

Amit Vakodkar
Greenhorn

Joined: May 28, 2007
Posts: 10
Hi All,

I am trying to create a Slider for date range, ie from current date to last 3 months. Suppose I have 3months Jan(31 days) - Feb(28) - Mar(31), when i move the slider its displays the value as "Jan <date>", but as soon as I try to go fwd with another month it displays "Feb 32" & so on. I want to know how can I reset the value so that it changes the value with the month.

Please Ignore the IF loop below.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60797
    
  65

I'd do all the "date math" using the Date class and converting all values to milliseconds.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Amit Vakodkar
Greenhorn

Joined: May 28, 2007
Posts: 10
Yeah all the variables you see are getting the values from Date Class in JS, all that is working fine but the issue is with slider value, which i need to change from Jan 31 to Feb 1 & not Feb 32. I have a input box which displays the value of the slider, in my case which displays Date/

Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60797
    
  65

Use the Date class to do the date math -- using string concatenation isn't going to work out well.
Amit Vakodkar
Greenhorn

Joined: May 28, 2007
Posts: 10
Take the Scenario as: I have a Jquery Slider which has the min as 1 & max as 100. When i move the slider to 31, it should show the msg below as "Jan 31", but as soon as i move to 32 the value which is displayed should show Feb 1, but in my case it is showing Feb 32. Is there any way where in I can reset the value back as 1 at the same time not allowing the slider to move back to the 1st position.

the ui.value in jquery comes as 1...31 32 33 34 ....
below i display as Jan 31

What I need is to change the ui.value such that as soon as it goes beyond 31 it should show the Message as Feb 1.

Eg: UI.Value | Display
31 Jan 31
32 Feb 1
33 Feb 2
34 Feb 3

Bottom line is that I want to show the Calendar dates in Jquery Slider.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Amit Vakodkar wrote:Take the Scenario as: I have a Jquery Slider which has the min as 1 & max as 100. When i move the slider to 31, it should show the msg below as "Jan 31", but as soon as i move to 32 the value which is displayed should show Feb 1, but in my case it is showing Feb 32. Is there any way where in I can reset the value back as 1 at the same time not allowing the slider to move back to the 1st position.

the ui.value in jquery comes as 1...31 32 33 34 ....
below i display as Jan 31

What I need is to change the ui.value such that as soon as it goes beyond 31 it should show the Message as Feb 1.

Eg: UI.Value | Display
31 Jan 31
32 Feb 1
33 Feb 2
34 Feb 3

Bottom line is that I want to show the Calendar dates in Jquery Slider.


Just keep 2 variables. One that represents the slider value (1-100) and another that represents the day value. Update both when the slider changes.


GenRocket - Experts at Building Test Data
Amit Vakodkar
Greenhorn

Joined: May 28, 2007
Posts: 10
How can I change the ui.value which comes from the slider value to display it as a Date corresponding to a particular month. Although I am taking 2 variables the Issue is how to change the Ui.Value to the Date which we need.


[Thumbnail for Slider Issue.jpg]

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Off the cuff, you can't. The ui.value is needed to determine the position of the slider control. If you change it, you manipulate the UI. You need to keep this seperate. You need to calculate the fact that even though the ui.value is 32, your day value is really 1. They have to stay separate. As long as you can always map the ui.value to a date's day, you're good. I don't understand why you think the ui.value needs to match the day value.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JQuery Slider Issue in Value Resetting
 
Similar Threads
problems during validation
Jquery Slider - Form to be submitted with value of the slider when sliding is stopped
get the sysmonth and year in drop down box.
can form names b passed as parameters to javascript
JSP attendance management project error