Welcome To Snipplr


Everyone's Recent Snippets Tagged forms



Nothing special, just need it here to remember
0 479 posted 13 years ago by RWolford
simple jquery code to clear form fields
0 554 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 704 posted 13 years ago by FatFolderDesigner
http://www.vbdotnetheaven.com/UploadFile/thiagu304/passdata12262006073406AM/passdata.aspx
0 616 posted 13 years ago by hairajeshk
0 605 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 712 posted 13 years ago by FatFolderDesigner
0 574 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 837 posted 13 years ago by picxelplay
For instance when you want to leverage the JElements in a admin view form...
0 682 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 760 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 601 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 990 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 869 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 788 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 434 posted 13 years ago by prsjohnny
0 580 posted 13 years ago by sandman7OR
processes contact form input and produces an auto reply
0 543 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 560 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 657 posted 13 years ago by iqwebdev
0 532 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 486 posted 14 years ago by tbelknap
I made my own modifications to this.
1 728 posted 14 years ago by jessibird
adopted from: http://www.alistapart.com/articles/makingcompactformsmoreaccessible/
0 652 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 673 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 850 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 646 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 533 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 969 posted 14 years ago by Meander365