Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Cache form?

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #176042
    nixnerd
    Participant

    Hey all, I’m wondering how I might go about using cache on a form? I’m not even sure if I’m saying that right.

    Basically, what I want is a form where the person fills out their info and it’s processed with JS. Then, it just says “Message Sent!” with no page reload. Then, it is somehow sent to the server when they leave for further processing.

    Obviously, I don’t want to JUST use JS to process a form. That’s crazy. And… I don’t want a page refresh… so I’m wondering how I can have both.

    I’m assuming Node.js would be PERFECT for this.

    Here is an example:

    http://boy-coy.com/#contact

    It’s at the bottom.

    BTW, I’m just assuming this guy is processing his forms on the server. But the interaction is so beautiful and I want it.

    #176043
    shaneisme
    Participant

    Well you can use JUST JS if your whole stack is JS!

    I don’t have an easy way to do this myself. The last time I built one it was in PHP, and I simply had everything write to the database and any row that wasn’t marked as completed after X hours was deleted. Doing this with AJAX isn’t a huge leap.

    But these days, I’d use something like Meteor JS to build my stack and it has stuff built in that does what you like. It’s still in a public preview though, but I have been tooling around with it and have been amazed at how easy it is to do something like what you want in a very short period of time.

    #176046
    TheDutchCoder
    Participant

    You can write a proxy php file that does the actual form validation and then just call it through an AJAX request with (e.g.) jQuery.

    It’s not that hard to do, it’s secure (because the actual validation is done in PHP) and it allows you to stay on the same page (awesome!).

    This might be a good start:
    http://blog.teamtreehouse.com/create-ajax-contact-form

    #176084
    nixnerd
    Participant

    Well you can use JUST JS if your whole stack is JS!

    See, this is intriguing. Because this is actually for my personal site. So, I control the entire stack. I’m already using JS for templating and all kinds of other stuff. Why not just use Node.js/Express to process it on the server? I’m actually using Node.js already for Ghost. So, why not just use it to process forms?

    Any good tuts for Node form processing?

    #176120
    __
    Participant

    If you’re not using multipart forms (i.e., file uploads), body-parser is probably your best bet.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.