I have a multi step form, i want to create a field type that will show all steps above the form and highlight current step that user is one e.g:
1. Your details 2. Your Request 3. Finally
I will render out as ul li and put selected class if on current step. However my question is there a way to determine (something in session?) which step you are currently on?
One way (it might be a simpler one) is to inherit or wrap the contour form in your own user control.
If you look in the RenderForm.ascx markup you'll see that each fieldSet has a literal control in the cssClass definitions which add's the current page/section name to the cssClass. You can access this by looking into the controls collection of the contour control by looping or using FindControl.
When you got the name of the page/section you can open up the form definition form the API and determine the page based on the page name matching the text of the literal control. Note that if the page has a space in the name you will need to convert it the same way as contour does.
Do note that this will not be a field type. However, making it a field type also means that it will have to be saved as an entry to the form - which I can't really see makes any sense, but that might just be me.
Thought it would involve using your nice little wrapper technique. I was hoping there was something in session or viewstate to tell you current page, I know doc2form sticks current page in view state and updates as you move along.
Got another suggestion, which does not involve a wrapper :-) or inheriting the form. I'm using this technique to get the ID of a newly created contour record, but current page might be possibe if the workflow event partially submitted (or any other workflow even) fire for each page.
You can make a workflowtype and get the current page from e.record.CurrentPage, save it to the httpContext.items collection (sessions is not request specific and will get you in trouble). You can then make a user control which reads the current page from the items collection again.
Hm, not sure what's happening. With version 1.0.9.1 it works moving forward, the PartiallySubmitted is triggered for each page change. However moving backwards doesn't work. With 2 page form the resume event doesn't trigger at all, with 3 page form it doesn't trigger the first time the previous button is clicked, the second... n'th time however the event is triggered properly.I.e. going backwards from page 3 the event is triggered on page 1. Going backward from page 4 the even is triggered from page 2 and 1.
Not sure if this is fixed in version 1.0.10
If you choose to inherit the RenderForm instead of wrapping it you can overried the button clicks and set current page directly in context.items collection. Guess that's my best suggestion for now.
That is freaking awesome many thanks i reckon i can have some fun with that. Not with current project as the form is linear step where each step has mandatory fields.
Multipage form current page
Hello,
I have a multi step form, i want to create a field type that will show all steps above the form and highlight current step that user is one e.g:
1. Your details 2. Your Request 3. Finally
I will render out as ul li and put selected class if on current step. However my question is there a way to determine (something in session?) which step you are currently on?
Regards
Ismail
One way (it might be a simpler one) is to inherit or wrap the contour form in your own user control.
If you look in the RenderForm.ascx markup you'll see that each fieldSet has a literal control in the cssClass definitions which add's the current page/section name to the cssClass. You can access this by looking into the controls collection of the contour control by looping or using FindControl.
When you got the name of the page/section you can open up the form definition form the API and determine the page based on the page name matching the text of the literal control. Note that if the page has a space in the name you will need to convert it the same way as contour does.
Hope this helps,
Harald.
Do note that this will not be a field type. However, making it a field type also means that it will have to be saved as an entry to the form - which I can't really see makes any sense, but that might just be me.
Cheers,
Harald.
Harald,
Thought it would involve using your nice little wrapper technique. I was hoping there was something in session or viewstate to tell you current page, I know doc2form sticks current page in view state and updates as you move along.
Regards
Ismail
Got another suggestion, which does not involve a wrapper :-) or inheriting the form. I'm using this technique to get the ID of a newly created contour record, but current page might be possibe if the workflow event partially submitted (or any other workflow even) fire for each page.
You can make a workflowtype and get the current page from e.record.CurrentPage, save it to the httpContext.items collection (sessions is not request specific and will get you in trouble). You can then make a user control which reads the current page from the items collection again.
H.
Hm, not sure what's happening. With version 1.0.9.1 it works moving forward, the PartiallySubmitted is triggered for each page change. However moving backwards doesn't work. With 2 page form the resume event doesn't trigger at all, with 3 page form it doesn't trigger the first time the previous button is clicked, the second... n'th time however the event is triggered properly.I.e. going backwards from page 3 the event is triggered on page 1. Going backward from page 4 the even is triggered from page 2 and 1.
Not sure if this is fixed in version 1.0.10
If you choose to inherit the RenderForm instead of wrapping it you can overried the button clicks and set current page directly in context.items collection. Guess that's my best suggestion for now.
H.
Behaviour in 1.0.10 is the same as in 1.0.9.1.
Harald,
I have managed to hack something together for this that works see here I make use of inheritance.
Regards
Ismail
May be a friendly client side solution which I discovered last week:
http://tympanus.net/Tutorials/FancySlidingForm/
Folkert,
That is freaking awesome many thanks i reckon i can have some fun with that. Not with current project as the form is linear step where each step has mandatory fields.
Regards
Ismail
is working on a reply...