x First time here? Check out the FAQ
  • Avatar1811posts3441karma

    Can /base be used for comment form submission

    Warren Buckley started this topic September 24, 2009 @ 06:02, Go directly to the topic solution

    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 JavaScript was disabled would the user still be able to submit the form and do the valdiation in the /base code and reload the blog post page with a new anchor tag to that comment ID so that page is forced a reload and scrolls to that comment.

    eg: my-blog-post.aspx#comment-1026

    With Javascript enabled would it be possible to do the same base code minus the redirect - as I would like to resest the comment form and slide/fade in the comment the user has just submitted.

    If this makes no sense at all, please let me know so I cna try and explain my thoughts better.

    Warren :)

  • Avatar700posts2610karma
    Comment with ID: 15569
    Chris Koiak posted this reply September 24, 2009 @ 06:39

    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.


  • Warren Buckley posted this reply September 24, 2009 @ 09:09

    Hiya Chris
    Well its good to hear that base can work with and without JavaScript disabled.

    Well the client side validation will be done with the jQuery validation plugin:


    However to do the validation when Javascript is disabled and that when doing the vlaidation in base i am unsure how to return the error messages then.

    What are your thoughts Chris?


  • Avatar700posts2610karma
    Comment with ID: 15577
    Chris Koiak posted this reply September 24, 2009 @ 09:52

    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.


  • Warren Buckley posted this reply September 24, 2009 @ 10:10

    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.


  • Kenneth Solberg posted this reply September 25, 2009 @ 09:05

    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

  • Avatar3309posts6220karma2015 MVP
    adminMVPComment with ID: 15610
    Ismail Mayat posted this reply September 25, 2009 @ 10:25

    That is awesome, gives me  few ideas, cheers Warren for raising and cheers Kenneth for solution, both have some karma all round :-}



Please login or Sign up To post replies