Questions tagged [form]

An HTML form is a section of a document containing normal content, markup, special elements called controls and labels on those controls.

Filter by
Sorted by
Tagged with
1
vote
1answer
73 views

Auto generate database table

I have written my own little auto-generated table class, and I was wondering if you guys can give me some tips on how to make this code more elegant and secure and maybe compact it so I use only one ...
0
votes
2answers
321 views

Submitting a form via JSON

I have a file named feedback.js that I would like to improve. ...
2
votes
1answer
911 views

Purchase tickets calculation with JavaScript

I'm creating a page where users can purchase an adult, child or senior ticket, each with it's own pricing. Here's the code for review. Please let me know if there are ways to improve upon this code. ...
1
vote
1answer
80 views

Check PHP validation code

I have made a form in HTML and the form data should be send via email. For that purpose I have created a PHP script. I did read a lot about the importance of form validation in order to prevent ...
0
votes
1answer
78 views

React component wrappers for form fields with 90% similar code

I have a number of these components, but will show just two as an example. They're very similar, but the differences are enough to where splitting them out felt needed. What I really need is some help....
2
votes
1answer
79 views

Password reveal functionality

I have made a password reveal feature, however the code is duplicated. Essentially all I want to be able to improve the code, however I'm not exactly sure how I could do this, all I know is it would ...
6
votes
2answers
351 views

Cake-ordering form and calculator

I’m a designer learning to code and I’ve built a simple form calculator for ordering cakes. I would love it if you could show me how to make the code more idiomatic. How can it be more consistent, ...
2
votes
2answers
62 views

Dynamically displaying or hiding checkboxes based on region selection country. Also select All / None included

This is basically my first real venture into JS coding ... I think what I have put together here is quite long-winded and could be streamlined but I'm not quite sure how. So I have a table with ...
1
vote
0answers
121 views

React form to add contacts to an app

I was recently building a form to add contacts to a play app I'm making and I finally got it to work. The problem is I'm not too happy with it. It's my first time building an application with React, ...
3
votes
2answers
1k views

Simplifying Counter of Checked Checkboxes

Is the following code a proper solution to my problem? I have a feeling it can be simplified quite a bit. If one of the first four checkboxes is checked the sum is 1; if two 1.5; if three 2; if ...
4
votes
2answers
142 views

Dynamic country, state select options

Here is code to dynamically choose between three country options (United States, Canada, Other). After the user selects a country it will show the related select option or an empty input (when "Other" ...
4
votes
1answer
65 views

Enforcing numeric inputs and sanitizing different formats for IE11 input fields

I'm working on a web form that functions with numeric inputs. I have <input type="number"> input fields and with Chrome and Firefox things work nicely since ...
0
votes
1answer
112 views

Writing cleaner PHP code to add additional options

I have a contact form that will perform validation on the server. Right now the form checks if the fields are empty or not. My goal is to expand it following: Check the fields for particular format, ...
6
votes
1answer
7k views

HTML form using <table> or <div>

I read that, in HTML, it is better to display non-tabular data using the <div> tag instead of the <table> tag. I ...
0
votes
1answer
3k views

Change URL on select change

I've made a method, which inserts a new query parameter, when the value of a select changes, then reloads the page. I've had enough of URL jQuery hax, so I figured it would be a great idea to put the ...
2
votes
1answer
59 views

Appending data to a web page from a form using a JavaScript class

Recently I've been reading about classes in JavaScript and decided to code this simple form to test them out. Even if the code works I am still pretty sure I lack understanding of classes and other ...
0
votes
2answers
52 views

jQuery function to display an alert when submitting blank fields

I am new to jquery and implemented following function in a js file in case of error- ...
2
votes
1answer
103 views

PHP Template: Image file upload handler

I'm trying to develop some templates for common PHP tasks I've been dealing with. One of which is a general image file upload handler. So far I'm using the following reusable code which seems to be ...
0
votes
0answers
2k views

Checkboxes behave like radio buttons with angular

This is short Angular 5 code which works as intended: check boxes behave like radio buttons - only one can be selected at a time. Both versions of 'toggleCheckbox' works but I am interested is if ...
2
votes
1answer
184 views

PHP contact form script

I have created a contact form that originally did not have any mechanism for sending out the email with whatever the user inputted in the fields. I have added it in here along with ReCaptcha check. I ...
2
votes
0answers
181 views

Managing multiple forms with individual updates and batch delete with checkboxes

I have a JSP page with a table containing data from java.util.List. The items from the list are taken from the database. Each row has an edit button that will get all the values from that specific ...
3
votes
1answer
756 views
1
vote
0answers
2k views

React: Simple Event Emitter on form example

I decided to study EventEmitter and play around with it in React JS for on example of a simple form. I built EventEmitter and added event 'newdata' to it. On event 'newdata' is called function where ...
-2
votes
1answer
76 views

My code is contain some vulnerabilities, how can i correct it and make it better

My code works well, but i still don't think it is well written. Can someone help to improve the code so as to get rid of vulnerabilities. My php code: ...
2
votes
1answer
85 views

A basic form with React

I have been working of a basic from using React and I need your help to improve this part of my code, especially validate and ...
4
votes
2answers
2k views

Is this contact form secure?

I have the following contact form, using PHP, JS and a bit of Ajax. I want to make sure that it is secure. ...
4
votes
1answer
84 views

Users adding each other in Laravel

I'm looking for a code review for the following system that I created. It allows a landlord, to add a tenant to start a tenancy. It has added, accept, reject, and prohibits a tenant from adding ...
2
votes
1answer
10k views

Student registration form

Problem statement Create one form having registration and student login fields for course using HTML5 elements and CSS3 styling. Expected Output Solution ...
2
votes
0answers
499 views

CodeIgniter CRUD form validation

I've developed a crud "helper" of sorts. Fields/columns are derived from the database and contain everything from the name of the field to the type and size of the field. Part of the system integrates ...
1
vote
0answers
50 views

Class to handle complex form using Angular ReactiveForms

I'm working with the ReactiveForms in Angular5 and trying to find a good way to do this. So, in my use case, I have a FormGroup inside my example.component.ts and when I need to add some FormControl ...
1
vote
0answers
929 views

Autosave reactive forms

I'm building an autosave for a data driven form on Angular. Here is our code snippet: ...
2
votes
1answer
75 views

Insert contact information from form fields into MySQL database when button is clicked

I am just a beginner trying to do my due diligence and research things properly. I am trying to go about the correct way of adding data into a database. I have read articles on the following: Not ...
2
votes
1answer
28 views

Instantiating icons, labels, and text fields for a contact form

While teaching myself Wx using this GridSizerTutorial page, I suddenly realized that there was a construct in Python that would let me considerably shorten the initialization code below. The three ...
4
votes
1answer
925 views

Layout for a Tkinter form

I am making a GUI application for a class. I have made the form layout (make_form()) using both Frame and grid, but I am not exactly sure that one should be mixing ...
2
votes
1answer
25k views

PHP PDO login with session

index.php,general message.php, logout.php, site ...
4
votes
1answer
842 views

Cross-browser double form submit prevention

We developed a potential solution for the double form submit prevention and we need some review on it. To be able to execute this code on asp.net we needed to add our function call directly into the <...
3
votes
1answer
132 views

Abstraction of google analytics with click events and forms submission handling

I'm keen to get some feedback on how I have utilized the Revealing Module pattern here. This code is part of a web application that is used by the public. The purpose of this code is to encapsulate ...
4
votes
0answers
111 views

Salesforce controller to implement a dynamic form

The code below is a controller for a Visualforce page (form). The controller determines if the form was previously created and saved or saved in progress in a previous action. If the form is new it ...
4
votes
2answers
3k views

PHP loop to generate an HTML form for the days in the coming week

There are two arrays, $states and $weekdays. I want to loop through them to create a form, an HTML table, or possibly some other ...
7
votes
3answers
10k views

Counting characters inside of a textarea using Angular

I have a textarea and need to calculate how many characters have been typed into it. Both of the following solutions work correctly—which would be preferable,...
1
vote
1answer
92 views

Preventing resubmission of form using timestamp

I am working on a method to prevent users from resubmitting a PHP form and I thought of many methods, but this one seemed to be the most reliable in my tests. I did not want to create redirects for ...
3
votes
0answers
3k views

React component: click to edit text

I am an experience backend programmer wanting to bring my frontend skills up to par. (My js experience up to this point is mashing things until they work rather than structured frontend applications). ...
3
votes
2answers
110 views

Changing form display based on selected values

The first part of my code is a datepicker for a "From" and "To", showing the date in MMDDYYYY format in a textbox and having the value in the From field 7 days prior to the current date. Second ...
5
votes
2answers
272 views

Displaying dependent options when a selection is made in a dropdown

I was wondering if someone could please point me in the right direction with this bit of JavaScript I have been working on. I have made this form that currently has onblur JavaScript validation and ...
4
votes
0answers
66 views

WordPress contact form plugin PHP and WP_REST improvements

TL;DR This month I wanted to improve my WordPress knowledge and create a simple form that wasn't bloated with features but was secure. I wanted to make sure this plugin improved my knowledge of: ...
5
votes
1answer
19k views
11
votes
3answers
284 views

Conditionally set attributes in MongoDB based on form fields

I have code which gets data from a POST request (request.form dict), compares with corresponding attribute in object ...
1
vote
1answer
92 views

Tying the enablement of one checkbox to another using AngularJS and jQuery

I'm new to AngularJS, coming from a jQuery background and I have a situation I've solved but only by including jQuery in an AngularJS function. Something just doesn't feel right doing this and I was ...
1
vote
1answer
68 views

Submit form additions or changes using AJAX, and display result

I am submitting my form using ajax. Here is the actual code: ...
8
votes
5answers
3k views

Selecting checkboxes based on URL parameters

Is there any way to reduce these lines of code? ...