Menu
  • HOME
  • TAGS

How can I post form into same php page and intercept it?

php,forms,post

change your form like this if you want to submit form in same page then no need to give form action give submit button a name and use isset in php code for button's submit <form action='' method='post'>" <table> <tr> <td>Matricola</td> <td> <input id='matricola' type='text'> </td> </tr> <tr> <td>PC</td> <td>...

Form controls not showing

c#,forms,winforms,user-interface,user-controls

You're never calling your FrmLogin.Frm method. If you intend this to be a constructor, drop the void and rename it to FrmLogin, like so: public FrmLogin() { this.Size = new Size(400, 600); Button btn = new Button(); btn.Text = "Something"; btn.Size = new Size(10, 10); btn.Location = new Point(10, 10);...

How can I customize a drop-down list form element in django?

python,django,forms

Don't know what field you want to filter, but you could do it like this: class A(forms.ModelForm): class Meta: model = ModelA def __init__(self, *args, **kwargs): super(A, self).__init__(*args, **kwargs) self.fields['your_field'].queryset = self.fields['your_field'].queryset \ .filter(some_filter_value=1) ...

How do I stop a button from triggering when the enter key is pressed? (focused)

vb.net,forms,button,focus

Your button by default is included in the tab order which results in the focus effect. Try removing the button from the tab order. You can do by setting the TabStop of your button to False when your form loads. I tried the example below and it worked for me....

Javascript into HTML form

javascript,html,forms

Updated Fiddle... $('#region').css('display','none'); $('#state').on('change', function() { var state= $('#state').val(); if(state=="A"||state=="B"){ $('#region').css('display','block'); }else{ $('#region').css('display','none'); } }); Try this.....

PHP redirect page works only in localhost

php,mysql,forms,redirect

<?php require_once('Connections/db.php'); ?> <?php if (isset($_POST['submit'])) { Change your above code to <?php require_once('Connections/db.php'); if (isset($_POST['submit'])) { and also remove the last ?> if you do not have html after that. After that, it should work. To turn on Error Reporting, place ini_set('display_errors',1); error_reporting(E_ALL); at the beginning of your php...

How to handle form submission in HTML5 + Thymeleaf

html5,forms,spring-boot,thymeleaf

I believe there could be 2 parts to your question and I will try to answer both. First on the form itself how would you get to a child_id to display fields from another object on the form. Since your Person class does not have a Child relationship you would...

Correct PHP contact form syntax? [duplicate]

php,forms,validation

The first time you load the form, $_POST will not have anything populated. Try changing if ($_POST["submit"]) { to if (isset($_POST["submit"])) { to determine if the form was in fact submitted and continue accordingly....

Form inside javascript not working

javascript,forms,table

The click events won't be bound to the elements, because the elements doesn't exist when the code runs. The elements won't exist until the user causes the tooltip to display. You can use delegated events in jQuery to bind the event to an existing parent element and look for events...

PHP+HTML: file not loaded from form

php,html,forms

You must use enctype="multipart/form-data" <form name="item" method="post" enctype="multipart/form-data"> ...

Updating fields of model using forms and views on Django 1.7

python,mysql,django,forms,e-commerce

In views.py (if your AUTH_USER_MODEL configured to Account) @login_required(login_url='/accounts/login/', template_name='market/postad.html') def newProduct(request): product_form = ProductForm(request.POST or None, request.FILES or None) if(request.method =='POST'): if product_form.is_valid(): product = product_form.save(commit=False) product.userid = Account.objects.get_or_create(user=request.user) product.save() else: print product_form.errors return render(request, template_name, {'product_form':product_form} ) ...

Javascript form sum of form inputs

javascript,jquery,html,html5,forms

You may find it easier to identify the issues you are having if you separate out each part of the process. If you store all of the elements you are going to be using at the beginning you will make your calculations easier to read plus avoid unnecessary DOM calls....

PHP email form without Refreshing Page

php,jquery,ajax,forms,email

Issues: if you usedocument.getElementById you must use id on your elements Add the data to your ajax request HTML: <!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> <script> $(document).ready(function(){ $( "#submitBtn" ).click(function( event ) { alert('pressed'); //values var name=document.getElementById('name').value; var email=document.getElementById('email').value; var phone=document.getElementById('phone').value; var...

Using PHP Variables as HTML Form Input Attributes

php,html,forms

It's possible, your syntax is incorrect though. You're double dipping on the php brackets. I usually prefer to do something like this instead of using print, it's easier to read, especially if your IDE is doing syntax highlighting: ?><td><input type='number' name='product1' id='product1' min='0' max='<?php echo $InStock ?>' value='0'></td><?php You could...

PHP submit to self form

php,forms

That's because your !empty($_POST) clause triggers because the $_POST variable isn't empty, as you just send some login credentials (they may be wrong but that doesn't matter). The else clause just triggers when nothing is sent, so basically whenever you submit anything with the form, if the login credentials are...

Codeigniter Form Validation Rule for match (password)

php,forms,codeigniter,validation

There is no need of putting old password has in hidden field. it's not even safe. you can create callback function for your own custom validation. Notice the comment i have did in following code. $config=array( array( 'field' => 'old_password', 'label' => 'oldpass', 'rules' => 'trim|required|callback_oldpassword_check' // Note: Notice added...

Enter causing postback even if no submit button is present

javascript,jquery,asp.net,forms

This can be addressed I believe with the accepted solution of the following post: ASP.Net page enter key causing post back Quoting: You could set the DefaultButton on the Form or a Panel. This way you have full control what happens. Set UseSubmitBehavior="False" on your Buttons. This disables the "AutoPostback"...

Form validation blocking the entire page

jquery,forms,unobtrusive-validation

You can add class="cancel" to the buttons you do not want to be disabled, here is how JQuery.Validate selects the buttons: this.find("input, button").filter(".cancel").click(function() { validator.cancelSubmit = true; }); ...

How to pass radio button value with php [closed]

javascript,php,html,forms

Quick'n dirty solution : <?php $checked=isset($_POST["radio"]) && $_POST["radio"]==="oneway"?"checked":""; ?> <input type="radio" name="radio" id="oneway" value="oneway" <?php echo $checked;?> /> but actually you should separate logic from template using a template engine like smarty or twig or mustache or whatever......

delegated event on form in every table row changes only the first one

jquery,forms

ID has to be unique. That's why it is called ID. Calling methods for specific $('#id') will only apply to the first occurring element matching the id, whilst using classes, $('.class'), will apply to all elements matching the class. If you want to share characteristics, events or other stuff with...

I want to pop up a div after submit a form

javascript,jquery,html,forms,popupwindow

I solve the issue see the example what I have done This is the post.php <html> <head> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('#form').on('submit',function(e){ e.preventDefault(); $.post('result.php', $(this).serialize(), function(response){ $('#result').html(response); }); }); }); </script> <style type="text/css">...

python BeautifulSoup find all input for specific form

python,html,forms,beautifulsoup,html-parsing

As noted in comments, chain find and find_all() for the context-specific search: form = soup.find('form') inputs = form.find_all('input') If you want direct input elements only, add recursive=False: form.find_all('input', recursive=False) Or, using CSS selectors: soup.select("form input") And, getting direct input child elements only: soup.select("form > input") ...

Javascript - return dynamic row data with checkbox input

javascript,forms,select,checkbox,tabular

You can try something like //use this to store the mapping of values, assuming loadid is unique for each record else a unique property of the record has to be used var watchlogic = {}; var watchLog = new XMLHttpRequest(); watchLog.onreadystatechange = function () { if (watchLog.readyState === 4) {...

How can I make a “*required field” error message appear for a drop down menu in a validating PHP form?

php,forms,validation,drop-down-menu,server-side

The span <span class="error">* <?php echo $rateErr;?></span> is inside the select...I bet if you inspected the element it does appear just not visible because it's not in an <option> tag. Try moving it outside....

Remove automaticaly entity in BD when choice value not selected (or null selected)

php,forms,symfony2,doctrine

You could use a doctrine entity listener: https://symfony.com/doc/current/bundles/DoctrineBundle/entity-listeners.html http://doctrine-orm.readthedocs.org/en/latest/reference/events.html#entity-listeners And have something like this in it: public function postUpdateHandler(Vote $vote, LifecycleEventArgs $event) { if (null === $vote->getValue()) { // Following two lines could be avoided with a onDelete: "SET NULL" in Picture orm mapping $picture = $vote->getPicture(); $picture->removeVote($vote); $this->em->remove($vote);...

Alfresco: Defining new Control-Params

forms,alfresco,alfresco-share

The variable which you are passing is defined in FTL file,which(FTL file) is referenced from share-config-custom.xml. Lets have deeper look. share-config-custom.xml Here Where we are declaring control parameter. <field-visibility> <show id="fieldName"/> </field-visibility> <appearance> <field id="fieldName" label="Name of Field"> <control template="/path/to/ftl/textarea.ftl" /> <control-param name="helpText">Description of field</control-param> </control> </field>...

AngularJS: how to save data in an html form between routes

javascript,html,angularjs,forms

With what you want is retain the form data on a page even when you have navigated away and then came back. There are 2 approaches to achieve this. Local Storage - Store information in local storage, on the form page, update scope based on the information stored in local...

javascript onblur onMouseOver calculate tax and autofill form input

javascript,php,html,html5,forms

First add an ID to your elements (this makes referencing the elements with JS easier). Ex <input name="cost" type="text"> becomes <input name="cost" ID="cost" type="text"> You need to add a script tag to house the JS code like this <script> var taxPerc = .19; document.getElementById("cost").onblur = function(){ document.getElementById("costplustax").value = parseFloat(document.getElementById("cost").value) *...

Devise nested attributes form field not showing

ruby-on-rails,ruby,forms,ruby-on-rails-3,devise

Ahh going over the Rails Cast it looks like I need to build the :job_description. This fixed it 1.times { @resource.jobs.build } in my Jobs controller. Jobs Controller def new @resource ||= User.new 1.times { @resource.jobs.build } end ...

Modify scaffold :string for :text

ruby-on-rails,forms,scaffolding

If you have already migrate, undo it: rake db:rollback rails destroy scaffold Dreams Dream:string And redo it rails generate scaffold Dreams Dream:text rake db:migrate You don't need to make rake db:rollback and rake db:migrate if you have just generated your scaffold. If it is not your last migration, you can...

How do I communicate the form parameters from the template to the route in ember.js?

forms,ember.js

1. About Controllers If you do not like to use controllers this would work for you (but I do not recommend you to follow this way): export default Ember.Route.extend({ actions: { add: function() { alert(this.controllerFor( this.get('routeName') ).get('name')); } } }); In fact, if you use name in template: {{input value=name}}...

Javascript asynchronous calls to a function that updates DOM elements are overlapping and causing issues

javascript,jquery,html,ajax,forms

If the user types fast, then you can end up with multiple animations in process at the same time and the .hide() which is not an animation will go in the wrong sequence, potentially ending up with the wrong display. The animations queue in order, the .hide() does not so...

How to store php form data to a web server in a plain text file?

php,forms,server,storage

You are looking for file_put_contents(). Simply collect the data and write it to your file. Here is the refined code: PS: You could consider starting with the php code first :-) <?php // define variables and set to empty values $nameErr = ''; $emailErr = ''; $commentErr = ''; $likesErr...

Run AJAX function on form submit button after javascript confirm() cancel

javascript,jquery,ajax,wordpress,forms

Dont use one(it will fire ajax submit or button click only once) , use here var IsBusy to check user is not repeatedly pressing the form submit, Try below code, var isBusy = false; //first time, busy state is false $('#publish').on('click', function (e) { if(isBusy == true) return ; //if...

Rails: get f.range_field to submit null or nil as default value

ruby-on-rails,forms

You can just add a hidden checkbox value to judge whether user select or not. = f.range_field :content, :value=> nil, :class=> "question-field percentage", :step => 10, :in => 0..101, :data => {:question => question.id = check_box_tag :range_clicked, true, false, style:'display:none;' and then add a js function to tell whether user...

django: raise an error similar to EmailField

django,forms,error-handling,emailfield

The popup that you see for the email it is not django validation. It is the build in in-browser html5 email field checking (and some older browsers will not do it for you). And you can't get any kind of validation in html5, but for checking field presents you can...

How to not update a model until form submission in Angular?

javascript,angularjs,forms,binding

You should clone your object using angular.copy. $scope.formData = angular.copy($scope.model); <form ng-submit="process()"> Value is : {{ formData.property }} <input type="text" ng-model="formData.property"> <button type="submit">Submit</button> </form> Then on process you update the model. $scope.model = angular.copy($scope.formData); You will be using a temporary model instead of your "real" one....

How to use javascript to validate the input field for restricting numbers only and setting the range as maximum and minimum

javascript,html,angularjs,forms,validation

<input type=number min=0 max=99999> Brought to you by: For the specification see: WHATWG HTML, section 4.10.5.1.13 For supported browsers see: Can I use: Number input type The Current State of HTML5 Forms: The min, max, and step Attributes For older browsers use: number-polyfill (A polyfill for implementing the HTML5 <input...

jQuery - Onclick append form inputs and assign name attribute

jquery,html,forms

Each time you click on #button get the last input and set the new name attribute. Then append the new input element in to the form: $('#button').on('click', function() { var form = $('#form'); var num = parseInt(form.find('input:last-of-type').attr('name')) + 1; form.append('<input type="file" name="' + num + '" />'); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>...

how to manage multiple form templates in fuelphp

php,forms,fuelphp

yes. try this: forge($name = 'default', $config = array()); $article_form = Fieldset::forge('article',array( // regular form definitions 'prep_value' => true, 'auto_id' => true, 'auto_id_prefix' => 'form_', 'form_method' => 'post', 'form_template' => "\n\t\t{open}\n\t\t<table>\n{fields}\n\t\t</table>\n\t\t{close}\n", 'fieldset_template' => "\n\t\t<tr><td colspan=\"2\">{open}<table>\n{fields}</table></td></tr>\n\t\t{close}\n", 'field_template' =>...

How do I create an editor template that works with existing data?

c#,asp.net,asp.net-mvc,forms,razor

You have created an EditorTemplate for typeof PersonViewModel but your use of [UIHint("_TextFormControl")] applied to typeof string means your passing string to the template, not PersonViewModel. Its unclear exactly what your trying to achieve here but based on your current model, he template needs to be @model String @Html.TextBox("") //...

Proper nesting of form tags in HTML

html5,forms,indentation

Indentation in HTML does not matter, it is purely for readability. For readability, in your example, I would indent. I would indent because the form tag is contained within the div tag. <div class="signup-form"> <form method="post"> <input type="text" value="First Name"> <input type="text" value="Last Name"> </form> </div> ...

Controller method: Contact form should render different page depending on where the form is used

ruby-on-rails,ruby,forms,ruby-on-rails-4,controller

You can use something called action_name in Rails 4. action_name gives you the name of the action your view got fired from. Now you can send this property to the method create through a hidden field like following: <%= hidden_field_tag "action_name", action_name %> This line of code will send params[:action_name]...

Carrying over a user's information to a new page and then editing it

php,html,forms

In the editusers.php script, look up the user in $_GET['id'] and use that information, not $user. <?php $con = mysqli_connect("localhost","root","","bfb"); $stmt = $con->prepare("SELECT firstname, lastname, email, username FROM users WHERE id = ?"); $stmt->bind_param("i", $_GET['id']); $stmt->execute(); $stmt->bind_result($firstname, $lastname, $email, $username); $stmt->store_result(); if ($stmt->fetch()) { ?> <form action="" method="post"> <div class="field">...

Symfony 2 unable to pass entity repository to form

php,forms,symfony2,runtime-error

You have not included the Symfony EnityRepository class at the top of your form file so PHP is looking for it in the same directory as your form class. Hence the error message. Add this to your form class (or qualify EntityRepository inline): use Doctrine\ORM\EntityRepository; ...

Multiple AJAX forms with the same ID on the same page

javascript,php,jquery,ajax,forms

Don't use the same ID for the top and bottom forms. An id must be unique in a document -- see MDN Docs. Instead have two separate id's and reference them both in the one jQuery call when you are binding to the submit event: $('#newsletter_top, #newsletter_bottom').on('submit', function(e) { //...

PHP sum echo result on the fly (difficult)

php,html,mysql,forms,search

Muy bien, maradoiano, tuve que realizar algunas acrobacias para correr tu código, la cosa está así: Para obtener la suma de todas las inversiones sencillamente se necesita una variable que acumule los resultados de todos los (costo * stock), llamémosla $total. Para desplegar este total ARRIBA de la tabla es...

Entering data into mysql database using php

php,mysql,forms,mamp

This shoud work, if not then check your usename and password... <?php $servername = "localhost"; $username = ""; $password = ""; $dbname = "first_db"; $pathway = $_POST['username']; username - is the name of your input. // Create connection $conn = mysqli_connect($servername, $username, $password, $dbname); // Check connection if (!$conn) {...

Dependencies in forms Symfony2

php,forms,symfony2,events,entities

Create a form type CardAttributeValueType for CardAttributeValue entity, inside this form add fields depending on passed attribute type: class CardAttributeValueType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event) { $value = $event->getData(); $form = $event->getForm(); if (!$value) { return; } switch ($value->getCardAttribute()->getType()) { case 'text': $form->add('valueVarchar',...

Converting form text in HTML into an array in JS

javascript,html,arrays,forms

Your array variable is object. You have to split the value of <input type="text" id="array"> not the object element. var array = document.getElementById("array"); array = array.value.split(" ").map(function (item) { return parseInt(item, 10); }); Or simpler: var array = document.getElementById("array").value.split(" ").map(function (item) { return parseInt(item, 10); }); ...

JavaScript validation on name field not working

javascript,forms,validation

You simply forgot to add the + sign at the end of your letters RegExp. i. e. var reg_letters = /^[A-ZÆØÅa-zæøå]$/; should be var reg_letters = /^[A-ZÆØÅa-zæøå]+$/;

Update Form Hidden Field Value wit button ID?

javascript,jquery,html,forms,twitter-bootstrap

You can access the element that triggered the popover as this within the function bound to content. So you could update your code to be: $('.pop').popover({ html : true, content: function() { $('#hidden-input').val(this.id); return $("#popover-content").html(); } }); Of course using whatever the correct selector is for your hidden input field....

Rails4 -> Change param name for select helper

ruby-on-rails,forms

For that, you need to use select_tag: select_tag "product['qty']", ... ...

Gravity Forms - Show link after submission

javascript,jquery,wordpress,forms

It turns out I found the appropriate event: $(document).bind('gform_confirmation_loaded', function() { //Do stuff }); ...

Manually highlight all invalid inputs of Angular Form

javascript,angularjs,forms,validation

You form markup should look like, so that when you click on submit ng-class will add submitted class on form that will give you idea that whenever you have submitted class on form and field has ng-invalid class, you can highlight those element Markup <ng-form name="form" ng-class="{submitted: submitted}" ng-submit="submitted=true; submit();">...

Select all input elements of a form the element belogs to

jquery,forms

This would be a correct syntax: $(this).closest('form').find(":input").prop("disabled", false); The :input is a jQuery extension that basically selects all form controls. ...

How to save a form which has been generated by overriding __init__?

django,forms,django-forms

for field in self.fields Or do I miss something ? ...

Angular submit not called when required fields not filled

javascript,angularjs,forms

You need to add novalidate to your form. The reason being, your browser is validating your form rather than letting your code do it. alternatively, do something like: <form ng-submit="submit()" name="form" novalidate> <ion-radio ng-repeat="item in items" ng-model="data.type" name="type" ng-value="item.value" ng-class="{'error' : form.type.$invalid && form.$submitted }" </form> form.$submitted will become true...

Force Uppercase on Symfony2 form text field

php,forms,symfony2

I’m not sure if you ask for server-side validation or assistance for client-side uppercase input. In case of the latter: you could add a CSS class or a data-* attribute (something like ->add('PID', 'text', ['label'=>'License Number', 'required' => FALSE, 'attr' => ['data-behavior' => 'uppercase']])) to the PID element. Then, you...

Javascript/jQuery form validation

javascript,jquery,forms,validation

Add an onchange event to your text inputs that will remove the error message. Rather than making a count of valid fields, I would also check for the existence of error messages. This will make it easier to add more fields to your form. function checkName(e) { //gather the calling...

Javascript - adding variables into a form submit

javascript,jquery,html,forms

Give your form a name, then: document.form_name.action = 'http://test.com/s/search.html?profile=_default&collection=general' + document.getElementById(' + item-select + ').value; Make sure you do this after the DOM is loaded, otherwise it won't work....

Django add an attribute class form in __init__.py

python,django,forms,django-forms

You need to assign the field to form.fields, not just form. However this is not really the way to do this. Instead, you should make all your forms inherit from a shared parent class, which defines the captcha field....

Parsley.js - one multi steps function for all forms

javascript,jquery,forms,parsley.js

You need to change the code to specify the form the user is currently working with. I've altered the code block you're using to do that, comments included: $(document).ready(function () { $('.next').on('click', function () { // Find the form whose button was just clicked var currentForm = $(this).parents('form').first(); var current...

Symfony2 Catchable Fatal Error: Argument 1 passed to entity Catchable Fatal Error: Argument 1 passed to entity

php,forms,symfony2,entity,symfony-2.6

Set data_class option for your InYourMindFriendType Checkout http://symfony.com/doc/current/reference/forms/types/form.html#data-class...

MySQL multi SELECT query into form and then UPDATE

php,mysql,forms,variables,post

Success, I figured it out myself [= i had to add a row to the end of the table with the end value of $i <tr hidden> <td hidden> <input type="text" name="ivalue" style="width:120px;" Value="'; echo $i;echo '" style="width:70px" hidden></font> </td> </tr> Then this was in my <form action="senddata.php" file> i...

html5 forms need php validation before inserting in to mysql?

html5,forms

Absolutely. Remember that anyone can send raw HTTP requests and fill in the fields with any data they like. Never trust user input; always check it server-side....

maxlength not working in html form input field with bootstrap

html5,forms,twitter-bootstrap,bootstrap,html-form

It is not bootstrap that are causing this. maxlength does only apply to <input>'s of type text, email, search, password, tel or url. See MDN. Thats why maxlength not works with your <input type="number" maxlength="2"> Proof of concept : text : <input type="text" maxlength="2"> number : <input type="number" maxlength="2"> here...

Put form fields two per line in bootstrap form

html,forms,twitter-bootstrap-3

You have to include the rows in a div. <div class="rows">. <div class="col-md-10"> <div class="form-group"> <legend>1st sth</legend> <div class="row"> <div class="col-md-2"> <select class="form-control" id="select"> <option value="1">1</option> <option value="1">1</option> <option value="1">1</option> </select> </div> <div class="col-md-3"> <input type="text" class="form-control" id="inputName" placeholder="name"> </div>...

WooCommerce query quantity on product page

php,forms,woocommerce

Well I had to add an ajax function to the input field that would then update a hidden field in my form. Then when the Calculate button is pressed, I have access to the updated quantity.

How to elegantly add and remove elements from DOM

javascript,html,forms

Yes, that has a worrying smell. You could create a check-function that runs each time someone clicks/types (depending on what you want to include in your form) a field. That functions itself needs certain conditions that are going to be checked. This is a quick example I put together. Use...

Laravel MethodNotAllowedHttpException

php,forms,exception,laravel,request

It looks to me your problem is the url in our routes. You are repeating them. Firstly I would recommend using named routes as it will give you a bit more definition between routes. I'd change your routes to Route::put('jurors/submit',[ 'as' => 'jurors.submit', 'uses' => '[email protected]' ]); Route::get('jurors',[ 'as' =>...

Form not submitted using jquery

javascript,jquery,html,forms

Your code works fine for me. you can check with this $(document).ready(function() { $("#offer1").click(function(event) { event.preventDefault(); $("#offer1Form").submit(); //document.getElementById("offer1Form").submit(); alert('something'); }); }); ...

Show only the requested forms using JS

javascript,jquery,html,html5,forms

Keep both the forms hidden at first and give a ID to each <a> and also to the <form> Then $("#id-of-btn1").click(function(){ $("#form-1").toggle(); }); and $("#id-of-btn2").click(function(){ $("#form-2").toggle(); }); EDIT: This could be a solution to make it completely independent of ID/Classes. If you give a class to div containing all the...

change the content of a select option

jquery,forms,select,text,options

If you specifically know that you want to change the second option element within the select, you can target it with :eq(): $('.myclass option:eq(1)').text('TWO'); Note that eq() works on a zero-based index, so 0 is the first element, 1 is the second and so on....

Rails Get data from form (saves in database) and display it / use it again

ruby-on-rails,forms

In Rails the ID column is used by convention when displaying resources. So lets say you have the following route defination: resources :msgs, only: [:show, :index, :new, :create] This would create the following routes: POST /msgs | msgs#create GET /msgs/new | msgs#new GET /msgs/:id | msgs#show GET /msgs | msgs#index...

Having Users IP Address Showing In My Email Form [duplicate]

php,html,forms,joomla

You can't be sure of the real IP of the person using your email form because they could be behind a proxy or VPN, but this is a way to get the best candidate IP address at the time of the visit (ref): function getUserIP() { $client = @$_SERVER['HTTP_CLIENT_IP']; $forward...

How to use button instead input, style input?

css,forms,jsp,servlets,post

jsp form button instead of input: <button type="submit" id="submitRegInput" name="reg"> <img src="images/okBtn.png"/> </button> and css: #submitRegInput { background: no-repeat url(../images/okBtn.png) 0 0; border: none; } ...

How can I prevent a form submission from taking me to a different page

javascript,php,html,forms

You cant. Default functionality for forms will redirect to whatever the action attribute holds. In order to do what you need, you need to use AJAX easy example with Jquery: $("form").submit(function(){ var postdata = $(this).serialize(); var url = $(this).attr("action"); //something.php; $.post(url, postdata, function(res){ console.log(res); //your PHP results alert('thanks'); }); });...

PHP: Submitting form data via $_POST works for all fields except radio buttons

php,forms,post,radio-button,radio

Radio buttons (and Checkboxes) are only passed back to the form in either the $_POST or $_GET arrays if they are actually checked. I notice you do not auto check one of them as you create the HTML so nothing is likely to be returned if the user makes no...

creating styled forms with html and css

html,css,forms

Use Bootstrap. This is the best option as it has inbuilt styles. Boostrap Link For forms...

Preg match for all phone numbers starting with 07045

php,forms,preg-match

You forgot delimiters at preg_match, and beginning of string (you try to match substring in whole string). preg_match('~^07045~', $phone) The second thing is that regex isn't necessary for this task, substr will be faster. if (substr($phone, 0, 5) == '07045') ...

Flask submit data outside of form input fields

python,forms,input,flask,args

I figured it out. I think. Not sure if this is the proper way to do it, but it works for me. jinja code {% for item in items %} <tr> <form id="adauga_{{ item.stoc_id }}" action="{{ url_for('adauga', denumire_med=item.denumire_med, producator=item.producator) }}" method="POST"> <td>{{ item.stoc_id }}</td> <td>{{ item.denumire_med }}</td> <td>{{ item.producator }}</td>...

Form with 2 submit buttons

javascript,html,forms,window.open

You can't get 'results' in the manner you're attempting. You'll need to try getting it via the ID reference, something like the following: <form name="myForm" onSubmit="return myfunction();"> <input type="text" id="firstfield" name="firstfield"/> ... repreated 7 more times... <input type="submit" value="Preview"/> <input type="submit" onClick="window.open(document.getElementById('firstField').value + '/' + document.getElementById('results').value);" value="Open"/> </form> /* Hidden...

How can I prevent a specific field from submitting a form with jquery?

jquery,forms

try this:- $(document).ready(function() { $('form').on('submit', function(e) { e.preventDefault(); $('#result').append('submit<br>'); return false; }); }); $('#no_return').on('keypress', function(e) { if(e.keyCode == 13) { e.preventDefault(); return false; } }); Demo...

Allow Button Submit on Click with jQuery

javascript,jquery,forms

I believe your problem is with this line e.preventDefault(); This is preventing the default behavior of the submit button, i.e., submitting! Therefore, remove it. Update After testing, I have found the problem. I believe your problem is with this line $(this).prop('disabled', true); For some reason, this is preventing the form...

PHP Form showing unpredictable error [duplicate]

php,forms

They are not errors, they are notices.... Notice: Undefined index: number in C:\xampp\htdocs\k\show_results_4.php on line 161 You are trying to retrieve the value of $_GET['number'] without check if $_GET['number'] exists Notice: Undefined index: category in C:\xampp\htdocs\k\show_results_4.php on line 162 You are trying to retrieve the value of $_GET['category'] without check...

C# - Numbering lines in richTextBox Windows Forms

c#,windows,forms,lines

The array exposed by the Lines property is zero based. You will want to change your for loop declaration to this: for (i=0;i<richTextBox1.Lines.Length;i++) As your code looks now you will try to access elements in the array that are out of bounds (as well as missing the first line)....

How to submit multiple forms with the same ID in AJAX

javascript,php,jquery,ajax,forms

Do not use same ID in same document, because it is against the specification. IDs should be unique. Use classes instead.

Javascript: Resetting variable value created by form

javascript,forms,variables

your function resetForm(){ document.getElementById("form").reset(); } should be function resetForm(){ document.getElementById("form").reset(); msg.innerText=""; msg.className=""; } basically: you are not re-setting #message back to hidden which is where you start. And, I am also making sure that innerText is blank. ...

Google Analytics Event Tracking Form select

javascript,jquery,forms,google-analytics

Google Analytic is expecting a numeric datatype, and you're giving it a string. You can convert that string to a number by doing any of the following (depending on your preference): +document.getElementById('liste_nybil').value parseInt(document.getElementById('liste_nybil').value, 10); Number(document.getElementById('liste_nybil').value); So your updated code might look like this: $('#liste_nybil').on('click', function () { ga('send', 'event', 'Fornøyd',...

Laravel 5 How to Pass 2 Models to a Form

php,forms,laravel,model,laravel-5

In short you need to pass your view a instance of Vehicle with Client - I know you're trying to do that with the join but I'm guessing that isn't the right way to do it. I set up a clean install with Laravel and it appears to work when...

php form get parameters from url and store it until the final page

php,mysql,forms,get

It looks like - but I may be wrong so please clarify any incorrect assumptions - but it looks like there are potentially several issues here: Get and post are different. Use $_REQUEST['var'] to select GET or POST (I think POST overwrites GET values in this situation, if both are...