ToString1
asked on
Implement wizard step UI navigation with jquery slider in MVC view
I have asp.net MVC2 app and have implemented wizard navigation to complete a customer survey.
Customers can fill out different surveys and each survey has a different number of questions.
A survey is loaded and each question is displayed one at a time with a NEXT button to proceed onto next question.
I need to implement something like a jquery slider/progress bar plugin or something experts can recommend
http://jqueryui.com/demos/slider/#rangemax
or something like
http://jqueryui.com/demos/progressbar/
so as a user progresses through survey by clicking the next button the slider progresses as well.
In the view I can get the total number of questions to use this as the range max.
How can I implement this?
Customers can fill out different surveys and each survey has a different number of questions.
A survey is loaded and each question is displayed one at a time with a NEXT button to proceed onto next question.
I need to implement something like a jquery slider/progress bar plugin or something experts can recommend
http://jqueryui.com/demos/slider/#rangemax
or something like
http://jqueryui.com/demos/progressbar/
so as a user progresses through survey by clicking the next button the slider progresses as well.
In the view I can get the total number of questions to use this as the range max.
How can I implement this?
ASKER
Ideally I want something from the jquery core like this
http://jqueryui.com/demos/slider/#rangemax
I need a code snippet of how to pass the number of questions to the slider so it progresses correctly.
http://jqueryui.com/demos/slider/#rangemax
I need a code snippet of how to pass the number of questions to the slider so it progresses correctly.
If i have understood the requirement correctly, you are looking for
Number of steps in the wizard
http://jqueryui.com/demos/slider/#option-step
<<I need a code snippet of how to pass the number of questions to the slider so it progresses correctly.>>
How would you like to distribute the questions among screens?
Number of steps in the wizard
http://jqueryui.com/demos/slider/#option-step
<<I need a code snippet of how to pass the number of questions to the slider so it progresses correctly.>>
How would you like to distribute the questions among screens?
ASKER
What I do is have an MVC ActionResult that returns one question at a time.
My view inherits from a viewmodel that passes in the total number of questions and the current question.
My view inherits from a viewmodel that passes in the total number of questions and the current question.
If you give min as '1' and max as 'number of questions', doesn't that give you what you are looking for?
$("#slider-range-max").sli der({
range: "max",
min: 1, \\starting point
max: 10, \\number of questions
value: 2,
slide: function(event, ui) {
$("#amount").val(ui.value) ;
}
});
$("#slider-range-max").sli
range: "max",
min: 1, \\starting point
max: 10, \\number of questions
value: 2,
slide: function(event, ui) {
$("#amount").val(ui.value)
}
});
ASKER
Hi Yes
It does but I am unsure of how to pass this to the jquery function from hidden fields in my view
So in my view I have
<input name="currentQuestionNo" type="hidden" value="<%Model.customer.qu stID%>" />
<input name="totalQuestions" type="hidden" value="<%Model.customer.qu stID%>" />
How can I pass questionNo to the jquery
$("#slider-range-max").sli der({
range: "max",
min: 1, \\starting point
max: 10, // totalQuestions from hidden field
value: 2, //currentQuestionNo from hidden field
slide: function(event, ui) {
$("#amount").val(ui.value) ;
}
});
It does but I am unsure of how to pass this to the jquery function from hidden fields in my view
So in my view I have
<input name="currentQuestionNo" type="hidden" value="<%Model.customer.qu
<input name="totalQuestions" type="hidden" value="<%Model.customer.qu
How can I pass questionNo to the jquery
$("#slider-range-max").sli
range: "max",
min: 1, \\starting point
max: 10, // totalQuestions from hidden field
value: 2, //currentQuestionNo from hidden field
slide: function(event, ui) {
$("#amount").val(ui.value)
}
});
Make it
$("#slider-range-max").sli der({
range: "max",
min: 1,
max: $(input[name='totalQuestio ns']).valu e,
value: 2,
slide: function(event, ui) {
$("#amount").val(ui.value) ;
}
});
$("#slider-range-max").sli
range: "max",
min: 1,
max: $(input[name='totalQuestio
value: 2,
slide: function(event, ui) {
$("#amount").val(ui.value)
}
});
ASKER
Thanks but if I try that I get "input undefined"
Its on the
max: $(input[name='totalQuestio ns']).valu e,
Its on the
max: $(input[name='totalQuestio
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
thanks for the points
http://flowplayer.org/tools/demos/scrollable/wizard.html
there are many wizard plugin available
http://plugins.jquery.com/plugin-tags/content-slider
http://www.downloadjavascripts.com/list/javasitejj91/Details.aspx
http://worcesterwideweb.com/jquery/wizard/