I'm hitting an issue when trying to use Contour's CodeFirst for a multi-page/step form.
The form data (pages, fieldsets, fields) all syncs from my code/class in the back-office no problem. I am able to preview the form (via the back-office), no problem.
However on the front-end (using the 'Razor' macro), the form displays the first page okay - but pressing the 'Next' button, it reloads the first page again. It wont progress to the second page. :-(
I've checked for JS errors, but nothing there. So next I tried to recreate the form without CodeFirst - added a couple of pages, each with a couple of fields. Then trying the manual form on the front-end, I can step through each page, no problems!
I started to dig a little deeper - to see if it was a problem with my code/class. I exported both forms in the back-office (the CodeFirst generated one and the manual one). Then I compared the exported XML.
The only major difference between them was that the CodeFirst generated one had the <Field>'s <SortOrder> and <PageIndex> values off-by-one. So that the first page had an index of '1' (instead of '0'). Not sure if that has an impact?
Curious if you have had any issues with CodeFirst and multi-page forms?
Contour CodeFirst for Multi-Page Form
Hi Tim,
I'm hitting an issue when trying to use Contour's CodeFirst for a multi-page/step form.
The form data (pages, fieldsets, fields) all syncs from my code/class in the back-office no problem. I am able to preview the form (via the back-office), no problem.
However on the front-end (using the 'Razor' macro), the form displays the first page okay - but pressing the 'Next' button, it reloads the first page again. It wont progress to the second page. :-(
I've checked for JS errors, but nothing there. So next I tried to recreate the form without CodeFirst - added a couple of pages, each with a couple of fields. Then trying the manual form on the front-end, I can step through each page, no problems!
I started to dig a little deeper - to see if it was a problem with my code/class. I exported both forms in the back-office (the CodeFirst generated one and the manual one). Then I compared the exported XML.
The only major difference between them was that the CodeFirst generated one had the
<Field>
's<SortOrder>
and<PageIndex>
values off-by-one. So that the first page had an index of '1' (instead of '0'). Not sure if that has an impact?Curious if you have had any issues with CodeFirst and multi-page forms?
I'm using Contour v3.0.14 on Umbraco v6.1.2
Thanks in advance,
- Lee.
Comment author was deleted
Ok thanks for the details will take a look
Thanks Tim. I forgot to add that I'm using MVC render mode.
I've figured it out!
In my MVC view I had the Guid in uppercase, like so...
I actually had the Guid as a string constant in my CodeFirst class.
So while I was testing out the manually created forms, I'd noticed that their Guids were lowercase - so I switched mine to lowercase...
... and Ta-dah! The multi-page/steps work fine now. :facepalm:
At least I'll know this for future reference.
Thanks,
- Lee
Comment author was deleted
Ah great it's working now :)
I didnt think GUIDs were meant to be case sensitive???
M.
@Martin - they aren't ... assumed they were being compared as strings.
Where did you learn how to create a multi step form with code first? I don't even know where to start :(
Comment author was deleted
@Dan, it depends on the name you give your pages/fieldsets that will be used to create the different pages/fieldsets
is working on a reply...