Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Warren Buckley 2106 posts 4836 karma points MVP ∞ admin hq c-trib
    Sep 24, 2009 @ 18:02
    Warren Buckley
    1

    Can /base be used for comment form submission

    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 :)

  • Chris Koiak 700 posts 2626 karma points
    Sep 24, 2009 @ 18:39
    Chris Koiak
    0

    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.

    Chris

  • Warren Buckley 2106 posts 4836 karma points MVP ∞ admin hq c-trib
    Sep 24, 2009 @ 21:09
    Warren Buckley
    0

    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:

    http://bassistance.de/jquery-plugins/jquery-plugin-validation/
    http://docs.jquery.com/Plugins/Validation

    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?

    Warren

  • Chris Koiak 700 posts 2626 karma points
    Sep 24, 2009 @ 21:52
    Chris Koiak
    0

    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 2106 posts 4836 karma points MVP ∞ admin hq c-trib
    Sep 24, 2009 @ 22:10
    Warren Buckley
    0

    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.

    Warren

  • Kenneth Solberg 227 posts 418 karma points
    Sep 25, 2009 @ 09:05
    Kenneth Solberg
    4

    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

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Sep 25, 2009 @ 10:25
    Ismail Mayat
    0

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

    Regards

    Ismail

Please Sign in or register to post replies

Write your reply to:

Draft