An HTML form is a section of a document containing normal content, markup, special elements called controls and labels on those controls.
6
votes
2answers
273 views
Updating the presentation of a credit card field as the card type becomes known
The goal here is to, add a credit card image, and remove all other credit card images, of a certain input field.
I had a even larger code, with a lot of addClass() and removeClass()... then, I shrink ...
4
votes
1answer
38 views
Limiting the number of text fields created
I need to make sure that the max of text fields created is limited to 10 at most.
It's a script that I've ripped off elsewhere, and have modified it via help from StackOverflow on a couple of other ...
2
votes
2answers
68 views
Registering usernames and passwords to a database
Here is my script that registers a user to a database. I am still very much a newbie when it comes to this topic so any guidance would be greatly appreciated.
...
3
votes
2answers
124 views
Mutually exclusive radio buttons
Here is a small code snippet I wrote that I feel is pretty naive. I copied the code directly from my project and renamed some ID/class names.
I'd like to know how you could help to improve/refactor ...
3
votes
1answer
115 views
Basic login script for educational purposes
I have created a login script to demonstrate the usage of sessions in PHP. The focus is not on security, databases or encryption. The idea is to exemplify how you can use sessions to protect pages ...
2
votes
2answers
37 views
Model object for form validation
In order to perform form validation, I have created a custom object:
...
4
votes
2answers
215 views
Upload a photo with a unique name using PHP
I have written a script for basic uploading of a single image to a web server using PHP. This is an example that is intended for educational purposes in a basic PHP course. It does not take extensive ...
4
votes
1answer
44 views
Generating a dynamically expandable form with multiple similar categories
Overview:
Here's the look of my form.
In this example, I have a form that allows dynamically adding fields in each category. Like, I can add multiple attractions like 5 attractions, same goes for ...
3
votes
1answer
62 views
Forms - Ordered fields vs. dynamic iterations
I've made about 2 forms that have a server side action using PHP. For the first one, I made a variable for every form field and mapped it to $_POST["name"]. For ...
9
votes
5answers
342 views
Prorated Refund Calculator (v2)
This is a follow-up question to original Prorated Refund Calculator. Here is the summary of the changes I made since last, thanks to the good answers and some study of my own.
Did away with ...
4
votes
1answer
60 views
Check field values against a preset object
I want to check some fields values in a form against an existing object's values. If the values match, change a class value (it will add a sign). The following code is working, but I would like to ...
5
votes
2answers
47 views
PriceDialog - Prompt & price validation
In a recent CodeReview I presented a Product Manager that manages product listings and prices. Based on the great feedback I have refactored the mentioned Prompt and validator class and want feedback ...
1
vote
3answers
92 views
Partial view for frequently used drop down lists
I have one input that is needed in many forms, so I created a partial view for that. In the partial view I query the database and generate a drop down list.
I just want to make sure, this is the best ...
4
votes
1answer
66 views
Generate form and append to the body
I'm writing a plugin and want it to have no dependencies. I create a form and append it to the page, but the code is really long. Does anyone have any suggestions to clean it up, perhaps shortening ...
3
votes
2answers
117 views
Use presets to change a form
I intend to populate some fields in a form based on some presets values. The user choose the presets from a list. The following code is working, but as I'm a newbie, I would like to know if I done it ...
10
votes
2answers
561 views
Checking all checkboxes
Problems:
Wanting to check all checkboxes when the checkbox w/id=checkall is checked.
Wanting to uncheck the "checkall" box when any other checkbox is unchecked.
Solution:
...
2
votes
2answers
170 views
jQuery range slider change text based on hidden field value
I am working on a jQuery ratings function that uses the Foundation range slider. My current implementation works correctly on 2 of 7 of my range sliders. However, I am quickly realising that my ...
2
votes
1answer
225 views
Submit an array as html form value using JavaScript
I'm sending data from a form with a variable number of fields via an ajax call. Some of the fields are grouped together so I have opted to send them as an array of JSON objects to keep the groupings ...
0
votes
1answer
117 views
Processing selected and deselected elements
I think that this code is very bad because it does not agree with DRY principle. Can you advise me how to improve it?
...
4
votes
1answer
74 views
Saving a form to a database
I have a windows form application which uses a form for two different purposes. We use the form for both our handheld system and our in-house system.
I would just like someone to review the code for ...
4
votes
2answers
228 views
CheckChanged event readability
I have a CheckChanged method that I would like to improve as it takes a lot of space in my program and really hurts readability.
The method prompts the user for ...
1
vote
1answer
45 views
Multiple form inputs droppable
I have a form with 11 inputs that relate to each column on a table, which is displayed above. Each input has an id that matches the a class in the table based on the column name. I want all the inputs ...
4
votes
1answer
39 views
Handler for a screencast submission form
I have a monolithic script that powers this form:
Here it is:
...
1
vote
2answers
87 views
Making datastore inserts with Google App Engine and WTForms
I have a class for making datastore inserts with Google App Engine and WTForms. Now I want to refactor it into smaller units but I'm not sure how to do it. Can you help me find what needs to be done? ...
5
votes
1answer
867 views
Working with group of checkboxes in MS Excel
I have the following checkbox as depicted by the image below:
The checkboxes are in 3 groups. Confidentiality, Integrity ad Availability. When the first in is clicked, the Confidentiality turns Red ...
4
votes
1answer
175 views
jQuery Datepicker Plugin
I created a jQuery plugin that converts a text field to a 3 drop down, datepicker. It allows the user to select a Day, Month and Year rather than type the date in an input box.
The original input ...
1
vote
1answer
241 views
Meteor Form Submission
I am hoping a Meteor guru can please review my code below and verify if I am properly using return false and ...
3
votes
1answer
93 views
Form builder class
I am trying to learn OOP in PHP. My PHP knowledge is pretty good, but haven't tried OOP before. I'm currently building a formbuilder class. Can you take a look and tell me if this is the right way?
...
1
vote
1answer
30 views
PHP form to database fit for purpose
This code is intended to take input from a form and append it to a database table. The same data is sent to a separate function for subsequent mailing to the respondent. I'm self-taught and it works ...
1
vote
0answers
28 views
Form valid combinations from CSV selection options
I am building a form with multiple select option fields. I am trying to only show the next field if it exists as a combination in the CSV file I am reading in. It's working fine right now and I am ...
3
votes
2answers
150 views
PHP contact form
I recently had my site hacked, with the main index file being overwritten (nothing else was touched). I'm assuming they hijacked my form input.
Are there any vulnerabilities in the code or does this ...
5
votes
1answer
163 views
Script to upload CV with cookie control
I have created a script which presents a popup on every 5th pageview.
I would like to try to use just PHP cookies. However, due to the requirement of setting them before any content is output, it ...
2
votes
1answer
76 views
Getting duration between two dates
I'm developing on a web application where I have a start and a finish date and time and have to set the duration between it.
There are inputs for dates and times.
Then, I have this function which ...
2
votes
4answers
170 views
Returns an array of all inputs with specified name
I've made a nice little function to return a NodeList array containing all the inputs that have a specified name attribute:
...
3
votes
1answer
131 views
Checking checkboxes
I wrote this code for checking checkboxes. There are two groups of checkbox: each group's checkboxes have one common class all_perks and one individual class ...
3
votes
3answers
81 views
Validating conditions for enabling sign-up button
On an authentication view, there are some inputs, like password, email, etc and a sign up button which is enabled only if theses inputs are not empty.
So what I have is this function:
...
2
votes
3answers
115 views
8
votes
2answers
2k views
How much is 2 + 2?
I'm currently working on a kind of PHP Quiz about mathematical calculations. We show a mathematical equation, and user need to input his answer.
Currently, this is what I have written:
...
2
votes
0answers
128 views
HTML5/CSS live Validation w/jQuery
I've been working on a live form validation project, initially I intended on finding a way to solely use CSS for said validation but it quickly became apparent I would require some jQuery to get it to ...
0
votes
0answers
236 views
Using CasperJS to fetch and fill option values
I use the following CasperJS code to fetch data from an ASPX page with combo drop down box, which option values are dynamically populated via __doPostBack().
the ...
3
votes
1answer
248 views
HTML and CSS markup for flexible form layout
I'm trying to have a HTML / CSS structure for flexible layouts for forms. I tried to look at Bootstrap codes for help with this (without actually using Bootstrap itself). I've gone with something ...
10
votes
2answers
382 views
jQuery AJAX form using bad practice
I have not worked with jQuery for years so my knowledge of it is extremely limited. I wrote the following form and received a comment elsewhere saying:
This is some of the worst JavaScript I've ...
7
votes
7answers
741 views
Changing element visibility based on multiple checkbox states
I am writing a script in JavaScript & HTML and have some optimization problems. In the for, loop I check a variable named ...
4
votes
2answers
57 views
Rendering a selection box for 50 states
I was creating a Rails form where users have to enter their state. I ended up creating a select tag which is really, really ugly.
I'd like to think there's a better way of writing this.
...
2
votes
0answers
145 views
Immediately send redirect response, preserving session data
This question is for Laravel 4 only, as the relevant parts are completely refactored in the upcoming Laravel 5.
I have written an helper function for validation, so I only have to put this in ...
1
vote
0answers
1k views
Parsing multipart/form-data in php for PUT requests
I have recently found that I needed to be able to parse multipart/form-data for PUT requests made to my REST API. This allows batch photo uploads, which has been a requested feature. As we all know, ...
3
votes
3answers
286 views
Triggering editing mode for a form
I think that my code isn't perfect and I need a help to understand how to optimize it.
In my application I have a main form and several forms for data editing.
The user can:
Add a new item
Edit ...
1
vote
1answer
556 views
Reusable library to alert user of potentially unsaved changes
I wrote a small reusable component based of some of the examples to this question on Stack Overflow about Activating OnBeforeUnload only when field values have ...
1
vote
1answer
64 views
Best way to implement j_security login
I have a j_security login implemented but it's been giving me a lot of problems and wanted to know if there's anything that sticks out as incorrect or outright ...
3
votes
2answers
70 views
Initialise simple_form object inline
Using Rails 4 and a simple form, I'm rendering a couple of forms outside of their native controllers. Rather than scattering initialisers through my controllers, I wondered if it is cleaner to do the ...