22
votes
Updating dimensions when focus is lost from any of 9 columns
I don't do C# so pardon the syntax, but you should be able to reduce the amount of code by using a for loop over a string array with your column names.
Again I don't do C# but in Java you could do ...
15
votes
Accepted
Updating dimensions when focus is lost from any of 9 columns
A shorter version would be to create an anonymous array in the if statement combined with a collection initializer where you will add all of the column names and ...
10
votes
Selecting checkboxes based on URL parameters
Extract the chk parameter value from location.search and use a "lookup table" object:
...
7
votes
HTML 5 form validation and form handling
Validating HTML5 Code
It seems that you are new to HTML5, so it's a good idea to validate your code. You have 14 errors and 5 warnings in your code:
autofocus="on"...
7
votes
Accepted
Populating many fields in a form using jQuery/AJAX
For starters, you can make compound selectors so this:
...
7
votes
Selecting checkboxes based on URL parameters
First of all, it would help tremendously if you named the URL parameter values and the form element IDs consistently. Why do you have chk=webdes-check ...
7
votes
JS Function warning before closing browser
If you don't need the confirmExit function anywhere else, you can just assign it to to window.beforeunload.
...
7
votes
Simple checkboxes with React
I think everything Sam Onela said is great. I'm gonna add a few more things.
Don't modify your state directly
In general, it's considered bad practice to directly modify your state object. According ...
7
votes
Accepted
PHP HTML form Class - so far so good?
I have not conducted a deep review of your scripting, but I have a few pieces of superficial advice:
Study PSR-12 coding standards and obey every rule. This will make your code easier for you and ...
6
votes
Upload an image to a folder through a form
You should invert the order of your PHP processing and your HTML output. When working in PHP, always strive to adhere to this approach, as it will help you as you start working on more complex logic. ...
6
votes
Accepted
HTML form using <table> or <div>
Specification
In the HTML specifications you can find the following:
The HTML table model allows authors to arrange data -- text, preformatted text, images, links, forms, form fields, other tables,...
6
votes
Selecting checkboxes based on URL parameters
I don't do javascript but what I noticed right away is that you are doing url[1].toLowerCase() for each if and ...
6
votes
Accepted
Counting characters inside of a textarea using Angular
You don't need to declare an extra reference variable. I would suggest the first approach i.e. using [(ngModel)] for two-way data binding.
However, in the first ...
6
votes
Accepted
6
votes
PHP HTML form Class - so far so good?
You could make it much more simpler to read if you use templating engine. Rendering HTML right inside php is something many experienced developers try to avoid for multitude of reasons.
One of them ...
5
votes
Accepted
Using actionPerformed() to call different methods per radio button selection
Indeed, the conditional branching in actionPerformed(ActionEvent) is quite complex and prone to bugs. This implementation does too many things at the same time: ...
5
votes
Accepted
ListFind test conditions
You don't care what the numeric value here is, so don't test for it. You want a boolean, and I think the listFind() call is semantically boolean itself without the ...
5
votes
Accepted
Keyboard handler for selecting radio buttons
If you are sure it will always have a value just use the charAt value to build the id you try to select in each if block. Something like:
...
5
votes
Accepted
Upload an image to a folder through a form
The first thing I saw when I looked at your code was the obvious disregard to any kind of indentation!
It is nearly unreadable! There's no excuse to have a code without any indentation.
Throwing the ...
5
votes
Mask latitude text field
Unless you know for sure that the degrees, minutes, and seconds are always going to be 2 digits each, this approach will cause issues. I would recommend using 3 separate inputs for each value and ...
5
votes
Accepted
HTML Date Selector
I didn't pay much attention to your logic, but focusing on this question:
Can you elaborate on how you would separate this into a javascript class? I like the idea of reusability, but how would you ...
5
votes
JS Function warning before closing browser
You have defined the variable formmodified as a global variable. This means that it can be modified from anywhere using the code ...
5
votes
Accepted
Calculate Final Grade: follow-up
I went ahead and refactored your code a lot. However, before I get into that, lets talk about what you did and what you could have done differently.
Feel free to let me know if you want me to expand ...
5
votes
PHP function that clones HTML form structure to MySQL database structure
It looks like you are throwing caution to the wind here. I mean you are granting full control of your database structures to the end user and offering the raw mysqli errors when they arise. These ...
5
votes
Accepted
OOP PHP form builder with validation
This looks like proper OOP code. It doesn't just encapsulate a lot of functions in a single class. It's expandable with more input types and errors, but I am afraid that you might have overdone it a ...
5
votes
OOP PHP form builder with validation
OOP
I agree with the answer by Kiko. You didn't ask about MVC code but if that is a goal then it would be wise to only have HTML/text output by the view components - e.g. either in FormGenerator.php ...
4
votes
Student registration form
Styling and readability
You are using classes as id's, both by not using a class twice or more and by naming them after the specific element you are using the class for.
You do not use css-selectors ...
4
votes
HTML 5 form validation and form handling
Tim's answer addresses most of the problems. In addition to that:
Your <label> elements both miss a for attribute, and do ...
4
votes
Extracting first name, last name, phone number, and address from a form
You could create a method for it!
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
form × 387javascript × 188
php × 110
jquery × 109
html × 78
validation × 73
beginner × 41
dom × 22
event-handling × 21
python × 19
object-oriented × 19
react.js × 19
security × 17
jsx × 17
c# × 16
html5 × 16
ajax × 14
performance × 13
ruby-on-rails × 12
email × 12
datetime × 11
ruby × 10
comparative-review × 10
mysql × 9
authentication × 9