wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Text field input not sent with other form data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Text field input not sent with other form data" Watch "Text field input not sent with other form data" New topic
Author

Text field input not sent with other form data

Mark Peterson
Greenhorn

Joined: Sep 08, 2013
Posts: 5

In this survey, all code works great except when the submit button is clicked. The form returns all data except the data in text input fields - notEmpty, notEmpty2, and emailVal. Any help to get the text input field data to be sent also would be greatly appreciated.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61095
    
  66

Mark Peterson wrote: the data in text input fields - notEmpty, notEmpty2, and emailVal.

I'm confused. Those aren't text fields, they are JavaScript functions.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rob Crowther
author
Ranch Hand

Joined: Nov 06, 2012
Posts: 295
    
    5

The onsubmit action is something that happens entirely in the browser, the return value is either true (which means 'go ahead and submit the form') or false (which means 'do not submit'). If you want the server to see values, then those values have to be in fields in the form.


Read my books: Hello! HTML5 & CSS3 | HTML5 in Action | Read my blog
J. Kevin Robbins
Bartender

Joined: Dec 16, 2010
Posts: 919
    
  13

Also remember that the input fields in your form must have a "name" attribute. That's what the GET/POST will submit. It doesn't care about the field id, although you can make the name the same as the id if you wish.


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." -- Ted Nelson
Mark Peterson
Greenhorn

Joined: Sep 08, 2013
Posts: 5

Thanks for reminding me, J. Kevin, that fixed the problem!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61095
    
  66

J. Kevin Robbins wrote:although you can make the name the same as the id if you wish.


Although be careful with conflating name and id. names do not need to be unique, but ids do!
 
 
subject: Text field input not sent with other form data