Welcome To Snipplr
Everyone's Recent JavaScript 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
1793
posted 15 years ago by FatFolderDesigner
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
1953
posted 15 years ago by FatFolderDesigner
In regards to progressive enhancement, see also the [jQuery version](http://snipplr.com/view/48275/default-value-for-input-fields-jquery-version/).
6
2198
posted 15 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
1543
posted 15 years ago by cfleschhut
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
1833
posted 15 years ago by iqwebdev
adopted from:
http://www.alistapart.com/articles/makingcompactformsmoreaccessible/
0
1578
posted 16 years ago by cfleschhut
Usage:
//any element
window.onload = function(){
focusFirstInput();
}
or
// form elements under 'content-body'
window.onload = function(){
focusFirstInput('content-body');
}
0
1685
posted 16 years ago by neoprolog
Función para usar con el evento onkeydown, que funciona igual en todos los navegadores. Onkeypress devuelve 0 para las teclas especiales en navegadores que no sean Internet Explorer.
0
1745
posted 17 years ago by kcmr
Always always always backup client side validation with server side validation! =D
2
2089
posted 17 years ago by charmcitycoder
Requires Mootools 1.2<br/>
http://mootools.net/download
Based on the mootools javascript framework a re-usable class for easily implementing an array of on submit events.
* Confirmation - Provides an Ok, Cancel input box before proceeding furt...
1
1567
posted 17 years ago by dom111
I wrote this very quickly for a form I parse that allows a user to send a page to up to 5 friends. The script adds a click event to an image of a + sign beside an input box. When clicked if the user hasn't already added 5 friends to email, additional...
9
2136
posted 18 years ago by dmosher
replace submit buttons with nice images and does also the rollover. Easy.
1
1572
posted 18 years ago by valcartei
when testing forms you don't always want to fill in dummydate
this is a function i used to autofill and select values.
1
1595
posted 19 years ago by assbach