w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Rails Form Helper not reading question mark for object attribute
? is not a valid character for inclusion within a column name. First, create a new database migration: # from command line rails generate migration ChangeCorrectInAnswers Rename your column from correct? to correct: # in the resulting migration class ChangeCorrectInAnswers < ActiveRecord::Migration def up rename_column :answers :correct?, :correct end end Run the migration: # from command line rake db:migrate Finally, remove the ? from your field in the view: # app/views/questions/_form.html.erb <%= answer.check_box :correct %>

Categories : Ruby On Rails

Simple form / simple fields for, limit which records are displayed
I'm not sure what exactly do you mean... But if you are wish to limit the number of records that are being pulled from the database all you need to do in the controller is to use the :limit option in find for example MyModel.find(:all, :limit => 10)

Categories : Ruby On Rails

How to Create One Form Only in Rails to Submit two things Simple Form Carrier Wave
Why are you using two forms instead of one form? Include the image upload in the student model. <%= simple_form_for @student, :html => {:multipart => true} do |f| %> <%= f.input :last_name, label: '姓'%> <%= f.input :first_name, label: '名' %> <%= f.input :email, label: '电子邮件' %> <%= f.input :password, label: '密码' %> <%= f.input :college, label: '大学' %> <%= f.input :budget, label: '房间租金预算 (optional)' %> <%= f.file_field :picture, label: 'student photo (optional)' %> <%= f.button :submit %> <br> Can you call the helper method simple_form? If you need to form it this way what about <%= simple_form_for @student, :html => {:multipart => true}

Categories : Ruby On Rails

From symfony2 form to a simple form users get incorrect password
you should create a salt first (using some random function) and use $user->setSalt($salt) in your controller ... ... or generate the salt inside the User's __construct() method. FOSUserBundle i.e. creates the salt in the constructor of the User object using: public function __construct() { $this->salt = base_convert(sha1(uniqid(mt_rand(), true)), 16, 36); // ... } reference here. Otherwise the encoder called at $this->_encodePassword($user) won't find the salt calling the user object's getter getSalt(). tip: In symfony2 you should never try to access GET parameters using $_GET ... ... use the Request object instead. Please read the Symfony2 and HTTP Fundamentals chapter of the book.

Categories : Symfony2

Displaying a form on one line, using Ruby on Rails and Simple form
#FORM_ID input { display: inline-block; } just tried it with sign in form for Devise, Devise also uses simple_form and it works. Note! this won't work if your inputs are inside of another element. In this case you'll have to apply inline-block to that element. For exemple: html: <form id="login"> <div class="my-input"> <your input here> </div> </form> css: #FORM_ID .my-input { display: inline-block; }

Categories : Ruby On Rails

Rails nested form with simple form not showing nested objects' form
You need to specify <%= fields_for ... you are missing the = sign. Try: <%= f.fields_for :scores do |builder| %> Please refer to fields_for documentation on it's usage. Although fields_for works regardless of use of simple_form, you could use simple_fields_for as well since you are using simple_form as follows: <%= f.simple_fields_for :scores do |builder| %>

Categories : Ruby On Rails

Appending and substracting divs filled with data from one simple form to a form that contains all the divs grouped and ready to POST
So you want to have the order items listed in the second form like a pre-checkout shopping cart. If you use divs for that, they will not be submitted with the POST data to the server - they will be display-only. So you need to follow Robert's advice and save the 1st form's data to the DB each time an item is added/removed (in addition to his other reasons like not losing a customer's session info). That way the DB will already be up-to-date when they click Confirm Order. Or else you need to hook the Confirm Order button to a JS function that converts the divs back to JSON and posts that to the server to be stored in the DB. As far as creating the display-only div from the 1st form's data, your send_item_data function needs to loop over all the form's inputs, get their values, and add

Categories : PHP

Simple jQuery Form Design. I need jQuery Code for Below HTML Form
Something like this: $('.checkboxselector').click(function(){ $('#boxholdingtheitemsontheright').append('<some html of your choosing>' + $(this).next().text() + '</close>'); });

Categories : Jquery

Simple newsletter form
You can refactor your code like this: app/controllers/static_pages.rb def home @newsletter = Newsletter.new end In your view: <%= form_for @newsletter do |f| %> Regarding your issue, you might want to check @newsletter.errors to see if the validation process succeed or not. Try: class NewslettersController < ApplicationController respond_to :html def create @newsletter = Newsletter.new(params[:newsletter]) @newsletter.save respond_with @newsletter end end

Categories : Ruby On Rails

The choice with by simple form
Try rails wrapper in simple_form like this: = simple_form_for(@spot, :url => admin_spot_index_path) do |f| = f.error_notification = f.association :city, :collection => City.all, label: false = f.input :region do = f.select :region, Region.all.map { |r| [r.name, r.id] }, :prompt => "select Region" Thanks

Categories : Ruby On Rails

php simple insert form
At first glence, I can tell you that you're attempting to bind two paramters, but you only bind one. At second glance, you're also missing a closing bracket on your prepare. $statement =$mysqli->prepare("INSERT INTO detectives(name)VALUES(?,?)"); // ^^^ ? $statement->bind_param('ss',$_POST['name']); // ^^ ^^^^^^^^^^^^^^ ???

Categories : PHP

Simple Newsletter Signup form PHP
delete this: <tr> <td><font size=2 face=Arial>Name:</font></td> <td><input type="text" name="name" id="name" value=""></td> </tr> and this: var name = trim($F("name")); if (name=="") { // stuff } You should be able to remove other 'name' references in the JavaScript as well. Change things like this: $("name", "email").invoke('clear'); to: $("email").invoke('clear'); The php file will be this: <?php header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Pragma: no-cache"); // fetch the email and add it to the file $email = trim($_REQUEST["email"]); $pfileName = "myemails.txt"; $MyFile = fopen($pfileName, "a"); $nline=$email." "; f

Categories : PHP

how to set value of simple form checkbox to String?
If you want to go with check_box then its possible: <%= f.input :status, :as => :check_boxes, collection: [['Completed', 'completed']] %> But you should not expect two values from a check_box. It will carry only one value. the reverse will be considered if the check box is not checked.

Categories : Ruby On Rails

Simple form node js application
This example does not quite complete your task. But it is a self contained node.js program that displays a form and a different page upon form receipt. Copy it into a file and then run node filename.js and then go to http://localhost:3000 in a browser. Take note of the asynchronous code structure. I define a handler function but don't execute it immediately. We instead pass the function to http.createServer and then call .listen(3000). Now when an HTTP request comes in, the http server will pass a req, res pair to the handler function. req is the request object (this will contain the form data; see this question for some hints on how to get that data out. (I suggest that you jump right in and build a small Express app. It's a really nice framework.) //app.js // Load the built in 'http'

Categories : Node Js

A Simple 'copy-form Command
Function sexp-at-point gives you the sexp ("form") at the cursor. Just copy that to the kill-ring, using kill-ring-save. E.g.: (defun copy-sexp-at-point () (interactive) (let ((bnds (bounds-of-thing-at-point 'sexp))) (kill-ring-save (car bnds) (cdr bnds)))) Alternatively, just use kill-new: (defun copy-sexp-at-point () (interactive) (kill-new (thing-at-point 'sexp)))

Categories : Emacs

Passing simple string from one form to another
You need to pass the selecteddata to the form2 constructor. so modify the form 2 constructoo like this public form2(String SelectedData){ txtSelectedData.Text = SelectedData ; } and when creating an instance of form2, pass the value like this Form2 frm2 = new Form2(selectedOption.ToString());

Categories : C#

Simple Form Select without Model
f.input :email_format, :collection => ["Text and HTML", "Text Only", "HTML Only"], :prompt => "select email format" Refer this

Categories : Ruby On Rails

PHP simple activation Form MYSQL
There is no more support for mysql_* functions, they are officially deprecated, no longer maintained and will be removed in the future. You should update your code with PDO or MySQLi to ensure the functionality of your project in the future. As you can see below at each step we have a verification to know if we were able to connect to the database, if the SQL query was OK, if the parameters you want to give are OK and we also take the opportunity to prevent injection with the prepared statement and we finally execute it. Now notice how after we execute it, I verify how many rows were affected using $update->affected_rows to know if it was OK or not. The affected rows, can return: -1 indicating that the query returned an error 0 indicating no records were updated and a number abo

Categories : PHP

Foundation 4 with Rails Simple Form
You can compare the HTML of the forms created on these two pages: http://foundation.zurb.com/docs/components/forms.html http://foundation.zurb.com/old-docs/f3/forms.php

Categories : Ruby On Rails

Simple Form #input_field method
I think its related to your database field... I think you have set the databasefield as string, which hast 255 maximum length in general.. This could be the reason why it adds 255 automatically?

Categories : Ruby On Rails

security for a simple php search form
Yes it is enough to make it secure....you could always throw strip_tags() in there as well.... Although I would just do it in one line...instead of using three $find = htmlspecialchars(mysql_real_escape_string($_POST['find'])); But to really make it secure and up to date, you should stop using mysql_* functions as they are deprecated, and will be removed in any future relases of PHP.... You should instead switch to either mysqli_* or PDO, and implement prepared statements which handles security for you. Example...in PDO $db = new PDO('mysql:server=localhost;dbname=test', 'username', 'password'); $find = $_POST['find']; $query = $db->prepare('SELECT * FROM tbl_buyerguide WHERE rel_date BETWEEN NOW() AND DATE_ADD(now(), INTERVAL 2 MONTH) AND title LIKE :like ORDER BY

Categories : Forms

Issues with simple contact form
Sending mail from PHP is fraught with difficulties. You might not have an error in your code, but the mail might not be delivered because (select as many as you wish): it doesn't appear to come from an email address on the server; outbound email is blocked by default until you ask for it; Outbound mail on port 25 is blocked, and you have to use a specific server. your server is blacklisted; your message is blocked by a spam filter; some other reason. Make life easy on yourself. Use a library like swiftmailer or PHPmailer to handle sending the mail, and try something easy like delivering to an address on the sending server. Then work up from there. Be prepared to have to use SMTP Authentication, and possibly a paid external service to send the mail for you.

Categories : PHP

readonly check box on simple form can still be updated
Not with :readonly, no. The readonly HTML input attribute only prevents the user from changing the value of the field. It doesn't stop them from interacting with it, as clicking on it and toggling the checkmark shows. That only changes the state of the checkbox, whether it's on or off. The specs on the readonly attribute say this: readonly This Boolean attribute indicates that the user cannot modify the value of the control. If you don't want them changing the state at all, you may want to use disabled: disabled This Boolean attribute indicates that the form control is not available for interaction. In particular, the click event will not be dispatched on disabled controls. Also, a disabled control's value isn't submitted with the form. But since the input is not sent a

Categories : Ruby On Rails

Laravel 4 routing for simple contact us form
Since POST /contact-us posts to the index route, create a postIndex method: public function postIndex($data) { //Handle form return View::make('contact-us-success'); }

Categories : PHP

Migrating a simple Robotlegs application (form 1.5 to 2)
Which method has replaced the startup() in the Context In the Context use context.install to install extension that you want to use. most common one is MVCSBundle. use context.configure with (new ContextView) argument will start your context initialization. I can no longer just use "mediatorMap"; Do I need to create a MediatorMap Instance for this? you can inject IMediatorMap anywhere you need it, like in config [Inject] public var injector:IInjector; [Inject] public var mediatorMap:IMediatorMap; [Inject] public var commandMap:ISignalCommandMap; In the few RL2 example out there, many devs use the IConfig to configure their main Context; is this required, a good convention or optional. ..and in which way, is the Context 'configured' through this? yo

Categories : Actionscript

Simple mailing form with check boxes
action="mailto:?subject=Hello" This is not what you think it is. action specifies the destination URL. mailto: links are sent to the client, the server doesn't do anything with them. Ex: "mailto:mr.smith@matrix.com" "http://www.domain.com" mailto is like http here. To send mail using PHP you can the mail function or some other implementation. The action in your form will have to point to a script on your server.

Categories : PHP

Very simple subscribe form for under construction page
Make a simple form that lets users enter a name and email address. Have the email addresses go straight into a database or some other form of storage (could be as simple as a text file). Then, when ready, write a simple script that will send out an email to all the users in the database.

Categories : PHP

How Can I Create A Simple PHP Mail Form For My Website?
In regards to: "How can I create a simple php mail form that will always work?" There are many PHP based forms that can be found on the Web, and you will find many by Googling "php form with validation", for example. Make sure that it includes proper validation and sanitization. Here is one example on tutsplus.com Also consult Sanitize filters on PHP.net and here also for examples. PHP(.net) has a function called mail() which you can read up on. Click here to see it. Ajax is another good method to use for email/forms. Here is one example. Google "ajax email form" and you will get many hits.

Categories : PHP

Simple form not submitting to database PHP MySQL
You're missing the name attribute for your submit button so there's no schcreate key in $_POST and your query doesn't run. You can eliminate the need for the name attribute by checking $_SERVER['REQUEST_METHOD'] to get the request type, also you should use isset in each of your post values, so you could rewrite your code like this: <?php if ($_SERVER['REQUEST_METHOD'] === 'POST') { error_reporting(E_ALL); include_once("../php_includes/db_connect.php"); $name = isset($_POST['schname']) ? $_POST['schname'] : ''; $location = isset($_POST['schlocation']) ? $_POST['schlocation'] : ''; $daystart = isset($_POST['schday']) ? $_POST['schday'] : ''; $shiftcount = isset($_POST['schshiftcount']) ? $_POST['schshiftcount'] : ''; $st

Categories : PHP

Rails set scope for use in simple form association
You have to includes the Type model and then add a conditions on the internal field of the Type table: scope :external, includes(:type).where(types: { internal: false })

Categories : Ruby On Rails

bootstrap datapicker component using simple form
application.js or any .js file $(function() { $(".datepicker" ).datepicker({dateFormat: "dd/mm/yyyy"}); }); view file <div class="input-append date"> <%=f.text_field :field_name, :class=>'datepicker'%> <span class="add-on"><i class="icon-th"></i></span> </div>

Categories : Ruby On Rails

Codeigniter create a simple form to update the db
Try this. Your model should be function edit($id) { $data = array( 'note' => $_POST['note'], 'user'=> $_POST['user']// I don't think you need this. ); $this->db->where('id', $id); $this->db->update('company_contacts', $data); }

Categories : Codeigniter

Unexpected elseif in simple form validation
change this: // Username validation $query_username="SELECT username FROM users WHERE username='$username'"; $result_username=mysql_query($query_username) or die (mysql_error()); elseif (mysql_num_rows($result_username)>0) /* !!! ROW 72 !!! */ { echo "Username already registered. Pick something else"; } to this: // Username validation $query_username="SELECT username FROM users WHERE username='$username'"; $result_username=mysql_query($query_username) or die (mysql_error()); if (mysql_num_rows($result_username)>0) /* !!! ROW 72 !!! */ { echo "Username already registered. Pick something else"; } It is unexpected because else if i

Categories : PHP

passing variable to simple form symbol
You can pass i as a locals to the partial like follows: <%= render :partial => "form_item", :i => i %> and you'll have i available in the _form_item partial. Update: Local variables passed to partials are variables and not symbols. You could keep the name order_item like follows: <%= render :partial => "form_item", :order_item => i %> And update your order_item partial as follows: <%= simple_form_for order_item do |f| %> ..... <% end %> I think I understand why you do not want to change :order_item to just order_item. I think you are going to have to update your other calls to pass in local variable order_item where ever you are making a call to this partial.

Categories : Ruby On Rails

validation is not working in simple html form
Change this in formValidate() document.myForm.Name.value == "" to document.myForm.dob.value == "" document.myForm.EMail.value == "" to document.myForm.email.value == "" Do not use document.write("<b>" + day + "/" + month + "/" + year + "</b>"); It will replace the whole contents of your body

Categories : Javascript

Supply information automatically to simple form
Your first input of the form is specified as an input for the :user_id which is an integer in your table of users. Putting a full name there is creating a mismatch in data types. Does this help? Now that you want the username to be displayed without the user being able to change what is displayed, is there really a need to have this as an input? Can you just display the username in a normal <div></div>, so to speak?

Categories : Ruby On Rails

simple form tutorial, php method doesnt invoke
As comments pointed, the submit button does his default action while you are waiting for the ajax. You can get the form to use your function instead of the form action by selecting the form and using the submit method, like this : $('form').submit(function(){ /// function goes here })

Categories : PHP

hide div based on specific simple-form option value
try: var form = $('#dropdown'); form.change(function () { var $selected = $(this).find('option:selected'); if ($selected.val() === 'drop_down') { $('.selectobject').hide(); } else { $('.selectobject').show(); } });

Categories : Jquery

Foundation, simple form, text area, columns
Since you are using bootstrap, default properties of bootstrap applies to your input textarea. It causes the problem. I had the same problem but, with columns. You can overcome this problem by two solutions: 1.) Create a class and specify the height and width to be auto. Use the class wherever required. Create this class in your application.css or any css file. .test { width: auto; height: auto; } Now use this class in your ruby code. <%= f.input :description, as: :text, :input_html => { class: 'test', :cols => 5, :rows => 10 } %> Since you have explicitly specified the width and height to be auto, the bootstrap's textarea width, height will be overrided by the local class 'test' width and height. Hence :cols => 5, :rows => 10 properties will be set. 2.) Modif

Categories : Ruby On Rails

trying to work out the bugs in a simple email form - Still learning php
You are using if(isset($_POST['submit'])){ But there's no form element with the submit name and hence it fails to suffice the if condition, you can try replacing this <button type="submit" class="btn btn-primary">Book now</button> with <input type="submit" name="submit" class="btn btn-primary" value="Book now" />

Categories : PHP



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.