Welcome To Snipplr


Everyone's Recent Snippets Tagged forms



Nothing special, just need it here to remember
0 468 posted 13 years ago by RWolford
simple jquery code to clear form fields
0 544 posted 13 years ago by jelontok
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 688 posted 13 years ago by FatFolderDesigner
http://www.vbdotnetheaven.com/UploadFile/thiagu304/passdata12262006073406AM/passdata.aspx
0 609 posted 13 years ago by hairajeshk
0 596 posted 13 years ago by kidmizere
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 704 posted 13 years ago by FatFolderDesigner
0 566 posted 13 years ago by picxelplay
Drupal forms have their radio button options vertical (one on each line) by default. This will put them horizontally inline.
0 824 posted 13 years ago by picxelplay
For instance when you want to leverage the JElements in a admin view form...
0 665 posted 13 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 752 posted 13 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 591 posted 13 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 979 posted 13 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 856 posted 13 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 771 posted 13 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 426 posted 13 years ago by prsjohnny
0 568 posted 13 years ago by sandman7OR
processes contact form input and produces an auto reply
0 536 posted 13 years ago by sandman7OR
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 548 posted 13 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 648 posted 13 years ago by iqwebdev
0 525 posted 13 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 476 posted 14 years ago by tbelknap
I made my own modifications to this.
1 717 posted 14 years ago by jessibird
adopted from: http://www.alistapart.com/articles/makingcompactformsmoreaccessible/
0 638 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 664 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 835 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 635 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 524 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 955 posted 14 years ago by Meander365