I have a show that displays a form with fields filled out from a document. I would like to change the values ββin the field and then save the updated document.
I am having trouble finding a clear and concise example of how to do this.
Seriously, just ending this example, works wonders for so many people (I'm going to leave a lot of material to make it concise).
Install couchapp
This is beyond the scope of my question, but here is the completeness.
Create Kuchapping
Again, this is well beyond my question. Here is a short tutorial on how to create a couchapp.
Create Template
Create a folder in the root of your template called couchapp. Inside the templates folder, create an HTML page called myname.html. Insert the following into it.
<html> <head> <title>{{ title }}</title> </head> <body> <form method='post' action='#'> <fieldset> Hello <input type='text' name='name' value='{{ name }}'> <input type='submit' name='submit' value='submit'> </form> </body> </html>
Create show
See the tutorial above for hwo for this.
Add this code to the show called myname.
function(doc, req) { if (doc) { var ddoc = this var Mustache = require("vendor/couchapp/lib/mustache"); var data = { title: "The Name", name: "Bobbert" } return Mustache.to_html(ddoc.templates.myname, data) } else { return ('nothing here baby') } }
Refresh document with new name ...
So, who can complete this step on both the client side and the server side?
Please do not direct me to the guide, I need to read it in your words.
Thanks.
Edit:
Although the return value is not very pretty, just submit the form to the update handler by updating the document.