Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript input form
    text
    copied!<p>I have this datepicker function:</p> <pre><code>!!!5 html head link(type='text/css', href='http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css', rel='stylesheet') script(src='http://code.jquery.com/jquery-1.9.1.js', type='text/javascript') script(src='http://code.jquery.com/ui/1.10.3/jquery-ui.js', type='text/javascript') script $(function() { $.datepicker.setDefaults( $.extend($.datepicker.regional[""]) ); $("#datepicker").datepicker(); }); </code></pre> <p>I want to send the result of the chosen date with a input form.</p> <pre><code>input#datepicker(type='text') </code></pre> <p>I get the input field and can choose dates and so forth, but I can't seem to receive/transfer it to my other .js file.</p> <p>How can I package the result into a form (with the value)? With other values I just do something like this:</p> <pre><code>form(action="/registerActivity", method="post") select(name = "item[activity]") each point in points option(value=point.Activity) #{point.Activity} select(name ="item[participant]") option(value='testValue') Just a Option input#datepicker(type='text', name="item[date]") input(type="submit", value="Registrer participant") </code></pre> <p>And this is received like this:</p> <pre><code>registerActivity: function(req,res) { var item = req.body.item; newActivity = new activity(); newActivity.activityName = item.activity; newActivity.acitivtyParticipant = item.participant; newActivity.acitivtyDate = item.date; newActivity.save(function savedActivity(err){ if(err) { throw err; } }); res.redirect('/'); </code></pre> <p>Any help is greatly appreciated! </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload