0

In my appjs project, I display a webpage with the following form in it. When the user submits this form, I get an internal server error. Can you please tell me how to handle this /submit_pariring_code request in my app.js?

I can handle this form submission in a javascript code but that will make me to allow cross domain in the server side (which i don't want to do.)

  <form class="form-signin" action="/submit_pairing_code">
    <h3 class="form-signin-heading">Please enter your Pairing Code</h3>
    <input type="text" name="pairing_code" class="input-block-level" placeholder="Pairing Code">
    <br/>
    <input type="text" name="computer_name" class="input-block-level" placeholder="Your Computer Name">
    <br/>
    <button class="btn btn-large btn-primary" type="submit">Submit</button>
  </form>
nizam.sp
  • 4,002
  • 5
  • 39
  • 63
  • could you please let me know that what is this /submit_pairing_code in action tag ? – napendra Apr 05 '14 at 15:53
  • submit_pairing_code will submit the pairing code to a remote webserver and it will validate whether its correct. To send to the server, I want to receive it in the appjs desktop app first which will make a http request to remote web server. – nizam.sp Apr 05 '14 at 16:00
  • [The HTML5 placeholder attribute is not a substitute for the label element](http://www.456bereastreet.com/archive/201204/the_html5_placeholder_attribute_is_not_a_substitute_for_the_label_element/) – Quentin Apr 05 '14 at 16:10

1 Answers1

1

Following code did the magic.

var app = module.exports = require('appjs');
var http = require('http');

app.serveFilesFrom(__dirname + '/content');

app.router.get('/submit_pairing_code', function(request, response, next){
  response.send('Here is your pairing_code ' + request.params.pairing_code);
});
nizam.sp
  • 4,002
  • 5
  • 39
  • 63