Hot answers tagged

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 ...
user avatar
  • 16.4k
17 votes

Login Form in HTML

This is one of those places where if you ask 10 developers the same question, you will get at least 15 answers, and they are all valid. My 2 cents: It's 2014. Use HTML5. Discover jsfiddle.net for ...
user avatar
  • 171
17 votes
Accepted

Is this form submission validator professional?

A few things: Variables in JavaScript should be camelCased. PascalCase is traditionally left for types. CSS classes are ...
user avatar
  • 3,753
15 votes

Can people understand my form validation code?

Can people understand my code? Its certainly not bad code - but I believe there are some things you can do which will improve the speed with which people like me can grasp what it is doing (and why). ...
user avatar
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 ...
user avatar
  • 8,438
14 votes

Is this form submission validator professional?

Code should read like poetry People who don't know that jQuery(function); is the same as jQuery(document).ready(function); will ...
user avatar
  • 2,950
13 votes

Login Form in HTML

Security-wise, you need to make sure you a) never trust the user and b) never trust the user. You should realise that anyone has access to the GET parameters, ...
user avatar
13 votes
Accepted

PHP Form Builder Class

Right, a short and simple answer to each of your questions, for now. I'll be expanding on each of the issues through updates: Is it efficient Define efficient. If by that, you mean: is it fast, then ...
user avatar
13 votes

jQuery AJAX form using bad practice

In a sense, your code has already been reviewed, though I disagree with the excessively negative assessment. It is far from being awful and some of the worst JavaScript code ever. you manually ...
user avatar
10 votes

Checking login from associative array vulnerabilities

In this response, I assume that you are making a little script for yourself and some friends, i.e. not a large or critical system (e.g. that could delete other files). So you want some security, but ...
user avatar
  • 425
10 votes

Can people understand my form validation code?

Take care that I can read JavaScript but it was a whole time ago that I effectively wrote in that. I see you've created your own isNumeric function. Maybe you can ...
user avatar
  • 3,852
10 votes
Accepted

How much is 2 + 2?

Naming The naming of the arrays related to the operators is not so great: In $operatorsLetter you have the names of functions that do some operation. ...
user avatar
  • 107k
10 votes

How much is 2 + 2?

I would: improve (avoid) the PHP & HTML mixing. use one associative array instead of two array in order to define the operators avoid a while. If the problem ...
user avatar
10 votes

Selecting checkboxes based on URL parameters

Extract the chk parameter value from location.search and use a "lookup table" object: ...
user avatar
  • 1,952
9 votes
Accepted

Submit an array as an HTML form value using JavaScript

First of all, I'd make sure that supporting IE7 is actually required. It's a really old browser by now, and there are a lot of things that are much more difficult to do. Anyway, as for sending ...
user avatar
  • 32.9k
7 votes

CheckChanged event readability

Before thinking I didn't read well, I didn't want to rewrite everything: the final edit is at the bottom of the answer, but please read everything to understand it all. :) If the code inside the <...
user avatar
  • 5,553
7 votes

Checking all checkboxes

You can streamline the code by caching the selectors; this will improve performance as well. Next, you should use prop instead of ...
user avatar
  • 2,525
7 votes
Accepted

Prorated Refund Calculator (v2)

Your code is really clean, but it could be improved in places: You could consider placeholder attributes in the input fields on your HTML to display the format of ...
user avatar
  • 11.8k
7 votes
Accepted

Populating many fields in a form using jQuery/AJAX

For starters, you can make compound selectors so this: ...
user avatar
  • 3,918
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"...
user avatar
  • 24.9k
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 ...
user avatar
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 ...
user avatar
6 votes

Client-side validator for contact information form (name, phone, e-mail)

Validation problems Beware of overzealous validation. It's easy to create bugs by rejecting valid input. For example: Some people have only one name, so the one of the name fields must be allowed to ...
user avatar
  • 2,122
6 votes

Can people understand my form validation code?

In my eyes, any function called myFunction is not a good function. This applies to foo() and ...
user avatar
  • 161
6 votes

Login Form in HTML

I'm not an expert on HTML, but I am quite decent in using it and can give you the following pieces of advice: Seperate the CSS from your HTML page, it is already good that you have seperated (most) ...
user avatar
  • 10.6k
6 votes
Accepted

Form Validation Evaluation

I was wondering if this is good Well, are you just looking to prevent the normal user from messing up during registration? I think it would be fine for that. I'll see if I can point out flaws in ...
user avatar
  • 5,707
6 votes

Triggering editing mode for a form

A small note on naming: Being new to your code base, I have no idea what MIF represents and worse, IF looks a lot like ...
user avatar
  • 30.7k
6 votes
Accepted

Changing element visibility based on multiple checkbox states

First iteration You neglected to localize i. I'd like to rewrite the statements to make it more obvious that the visible flag ...
user avatar
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. ...
user avatar
  • 9,568
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,...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible