Umbracians for Unicef - the friendly fundraising
In the spirit of holidays and humanity, we started a fundraising for Unicef. You won't believe what we could change if every visitor on Our Umbraco donated a dollar or euro. Click and find out!
Hiya I just wanted to check I can do this with /base before and haven't dreamt it (as I have yet to still use /base yet).
OK I will try and explain the scenario as best as possible.
I would like a regular form tag that contains a url to /base to submit a comment (which will add a comment node to that particular blog post) and use the jQuery Validation plugin to do client side validation.
If this makes no sense at all, please let me know so I cna try and explain my thoughts better.
This is a great approach and is possible with Base.
How are you planning on returning appropriate error conditions? I've struggled finding a solution that would support displaying individual field validation message.
I'd love to see a generic solution that could be used to construct different forms as required.
Well the client side validation will be done with the jQuery validation plugin:
What are your thoughts Chris?
ahh... I may have typed too quickly...
Base may not be suitable for this. I've not used Base in this scenario, but I have done something similar on http://widgetframework.conscia.co.uk/widgetpage1.aspx
Have a look at the Weather form, and in particular try entering an invalid postcode in the edit section. Notice the (badly styled) error message that appears.
The weather-edit form is submtted to a 'page' (really an alternative template called AjaxController). The ajaxcontroller page responds with a full page of html, not with a 302 redirect. If JS was disabled the page would still submit to the same ajaxcontroller. The ajax controller returns a full page so would display fine.
The returned form (including the error message) is 'cut' from the response and replaces the form on the page.One advantage to this approach is that the error messages that are
returned can be customised per form field.
There's bloat on the ajax responses as the majority of the response is ignored, Maybe you could take this approach, but append a flag to the form-action via JS to surpress the full of the response.
Hopefully that makes sense.
Sorry Chris,Its probably getting a bit late for me but I didnt understand any of that. Let me re-read that tomorrow in the morning and hopefully it will make more sense.
I made a quick screencast that demonstrates a technique on how to do this with Umbraco Base. I forgot to mention validation, but that should obviously alway be on the serverside. Frontend validation is purely for enhanced usability and eye candy. http://screenr.com/po7
That is awesome, gives me few ideas, cheers Warren for raising and cheers Kenneth for solution, both have some karma all round :-}