Welcome To Snipplr
Everyone's Recent Snippets Tagged forms
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
This is a simple and effective way yo make sure people are actually filing out a form before submitting it. If you need to verify content it should be done server side (so that if you come across the odd person with javascript turned off it wont brea...
0
895
posted 13 years ago by FatFolderDesigner
http://www.vbdotnetheaven.com/UploadFile/thiagu304/passdata12262006073406AM/passdata.aspx
0
754
posted 13 years ago by hairajeshk
I was working on this for a new site ideal I have, though it might be useful for others. What this does it sent a AJAX POST request every time the as() function is called. Setting the form to run as() onkeyup will essentially make the form submit its...
1
910
posted 13 years ago by FatFolderDesigner
Drupal forms have their radio button options vertical (one on each line) by default. This will put them horizontally inline.
0
1016
posted 14 years ago by picxelplay
For instance when you want to leverage the JElements in a admin view form...
0
831
posted 14 years ago by harikaram
In regards to progressive enhancement, see also the [jQuery version](http://snipplr.com/view/48275/default-value-for-input-fields-jquery-version/).
6
935
posted 14 years ago by riddla
different solution by PPK:\\r\\n[http://www.quirksmode.org/book/examplescripts/maxlength/index.html](http://www.quirksmode.org/book/examplescripts/maxlength/index.html)
0
741
posted 14 years ago by cfleschhut
Show a form field if 1 value from a dropdown is chosen, hide is the other is chosen. Can be extended to include more fields and values. Could get messy if you start nesting more than 2 'if else' but it gets the job done.
0
1152
posted 14 years ago by Rembrand
Originally from http://www.electrictoolbox.com (see src)\r\nClear the default value of a form field when you click on it (when you want to type) and put it back if you leave without typing anything.
1
1050
posted 14 years ago by Rembrand
Originally form http://www.electrictoolbox.com\r\nComes in handy if you want to display a message in the field (\\\"type your password\\\") but mask the password itself.
1
952
posted 14 years ago by Rembrand
Display a default value in a text field that disappears on focus and reappears on blur **if** the field is blank.
0
552
posted 14 years ago by prsjohnny
A jQuery snippet to make form inputs show a help message which disappears on click (and comes back when the user enters nothing). Give your input the classes ‘remember’ to activate the snippet and (optionally) ‘unfocused’ as a CSS hook for ch...
2
713
posted 14 years ago by iqwebdev
Replace “value†with the default value. If the field is selected, the default value will go away. If the user has previously changed the field value, it’ll be left alone.
Alternatively, use onfocus=â€this.value=â€;†to always clear the f...
1
831
posted 14 years ago by iqwebdev
Keeping track of complex forms - especially those that exist within multiple jQuery UI tabs - can be a pain. This is a simple little function that will reorganize all visible inputs, buttons, drop-downs and links. Use it whenever switching between ta...
0
610
posted 14 years ago by tbelknap
adopted from:
http://www.alistapart.com/articles/makingcompactformsmoreaccessible/
0
809
posted 14 years ago by cfleschhut
NumberTextBox is a control used to restrict input to numbers, function keys and arithmetic symbols only. Otherwise, it works just like a normal TextBox.
0
811
posted 14 years ago by heatherk
A handy, generic form processor which validates presence of fields marked in a hidden value, like: <input>. Easy to override and customize as needed.
Adapted from a script found in PHP 5 Unleashed.
1
1018
posted 14 years ago by nate63179
By using hook_form_alter, you can add your own callback functions to any Drupal form.
These functions will be called when Drupal validates the form and when Drupal submits it.
In example below, a module called 'simple_checkout' adds its own hand...
1
802
posted 14 years ago by berkes
Put the height_options method into a helper file, and use it as the select collection for select or collection_select.
It allows heights between 4 feet and 7 feet. To change these limits, change 48 and 84 to some other numbers.
0
698
posted 14 years ago by 67ideas
I was recently faced with the problem of setting focus to the next input field. The challenge was that I didn’t know what that field was. So given an input field, find the next logical (in the order of the DOM) input field and set focus. I came up...
1
1164
posted 14 years ago by Meander365