forms

Form Validation Using Jquery

房东的猫 提交于 2020-01-16 01:21:53
问题 I am using jQuery to validate my form. I would like to see if the username is a single word. I see selector in Jquery http://jqueryvalidation.org/category/selectors/ but don't know how to use it in my case. <form id="register" name="register" action="/codejudge/contest.php" method="post" > <label for ="Username"> Username </label><br> <input type="text" class="register-control" id="Username" name="Username" placeholder="Enter Username"> <br><br> <label for ="Password"> Password </label><br>

How to submit a form using javascript

ε祈祈猫儿з 提交于 2020-01-16 00:45:13
问题 I'm trying to click on a submit button and submit a form using purely javascript. I have tried: document.getElementById('sell_form').submit(); and for(var i=0;i<document.getElementsByName('operation').length;i++){ if(document.getElementsByName('operation')[i].value=='Sell'){ document.getElementsByName('operation')[i].submit(); } } but I just can't get it. Can anyone show me how I could do this? Thanks in advance. The web code is: <form id="sell_form" class="ajaxform" action="/member/sell"

Undefined method `stringify_keys' in Messages Controller

纵然是瞬间 提交于 2020-01-15 23:05:15
问题 I am getting the following error when I try to submit a form (the form shows up when 1 user wants to message another user) NoMethodError in MessagesController#create undefined method `stringify_keys' for "":String Rails.root: /Users/fkhalid2008/loand Application Trace | Framework Trace | Full Trace app/controllers/messages_controller.rb:31:in `new' app/controllers/messages_controller.rb:31:in `create' Here is the relevant code from Messages Controller: def new @message = Message.new if params

How to remember posted fields in forms for drop down items?

落花浮王杯 提交于 2020-01-15 18:51:53
问题 I'm creating a simple registration page: <?php $firstName = $_POST['firstName']; ?> <form action="registration.php" method="post" enctype="multipart/form-data"> <table> <tr> <td> <b>First name:</b> </td> <td> <input type="text" name="firstName" size="30" maxlength="400" value="<?php echo $firstName; ?>" /> </td> </tr> <tr> <td> <input type="submit" value="Submit" /> </td> </tr> </table> </form> If the user enters an invalid first name (ex. too short, or weird symbols), the page reloads with

How to remember posted fields in forms for drop down items?

孤街浪徒 提交于 2020-01-15 18:51:18
问题 I'm creating a simple registration page: <?php $firstName = $_POST['firstName']; ?> <form action="registration.php" method="post" enctype="multipart/form-data"> <table> <tr> <td> <b>First name:</b> </td> <td> <input type="text" name="firstName" size="30" maxlength="400" value="<?php echo $firstName; ?>" /> </td> </tr> <tr> <td> <input type="submit" value="Submit" /> </td> </tr> </table> </form> If the user enters an invalid first name (ex. too short, or weird symbols), the page reloads with

Is it the Rails way to use form helper markup?

核能气质少年 提交于 2020-01-15 17:36:23
问题 I am reading the guide on form helpers http://guides.rubyonrails.org/form_helpers.html but I'm not sure whether I actually need to write my webpages this way.. I have an HTML form like this written in new.html.erb <form action="/posts" method="post"> <label for="title">Test</label> <input id="title"/> <input type="submit" value="submit"/> </form> (The posts page is from the Getting Started guide) When I submit the request, the server throws an ActionController::InvalidAuthenticityToken

SMTP Contact Form blank screen on Submit

社会主义新天地 提交于 2020-01-15 16:00:25
问题 I've been having alot of issues with contact form, does anyone know why my code is just bringing up a blank screen with "(URL)/mail.php when i press Submit on my form. Here is my code <h2 class="formhead">Contact Form</h2> <br> <form class="form" action="mail.php" method="post"> <p class="name"> <input type="text" name="name" id="name" placeholder="John Doe" /> <label for="name">Name</label> </p> <br> <p class="email"> <input type="text" name="email" id="email" placeholder="mail@example.com"

SMTP Contact Form blank screen on Submit

懵懂的女人 提交于 2020-01-15 15:57:02
问题 I've been having alot of issues with contact form, does anyone know why my code is just bringing up a blank screen with "(URL)/mail.php when i press Submit on my form. Here is my code <h2 class="formhead">Contact Form</h2> <br> <form class="form" action="mail.php" method="post"> <p class="name"> <input type="text" name="name" id="name" placeholder="John Doe" /> <label for="name">Name</label> </p> <br> <p class="email"> <input type="text" name="email" id="email" placeholder="mail@example.com"

Can't get post ajax request data python

自古美人都是妖i 提交于 2020-01-15 14:29:00
问题 I have html form: <form id = "contactForm"> <input type="text" name="name"></input> <input type="text" name="phone"></input> </form> I have Button and when I click it I am doing ajax post request: $.post( "/send-form", $('#contactForm').serialize() In chrome web inspector I can see that data is sent name=+gfdsfd&phone=89999 This is my backend function I am using Flask,Python: @app.route("/send-form", methods=['POST']) def send_form(): name = phone = email = country = text = None data =

Can't get post ajax request data python

我的未来我决定 提交于 2020-01-15 14:26:14
问题 I have html form: <form id = "contactForm"> <input type="text" name="name"></input> <input type="text" name="phone"></input> </form> I have Button and when I click it I am doing ajax post request: $.post( "/send-form", $('#contactForm').serialize() In chrome web inspector I can see that data is sent name=+gfdsfd&phone=89999 This is my backend function I am using Flask,Python: @app.route("/send-form", methods=['POST']) def send_form(): name = phone = email = country = text = None data =