Welcome To Snipplr
Everyone's Recent JavaScript Snippets Tagged form
- All /
 - JavaScript /
 - HTML /
 - PHP /
 - CSS /
 - Ruby /
 - Objective C
 
I frequently pass an array of elements from an HTML form to PHP, normally a list of checkboxes for removing database records.  This will loop through an array of  checkbox's with the same name & build a delimited string from the checked values.  Afte...
        
        
        
            0 
        
        
            1154 
        
                    posted 15 years ago by verostudios
            <input>
 
When used instead of my SharePoint: SaveButton above, the form saved it's data correctly, and the current page that the form was submitted from was reloaded for the user.
 
You could also put any URL in the __redirect={} that yo...
        
        
        
            0 
        
        
            1100 
        
                    posted 15 years ago by rumremix
            Fixes an issue if you have another login form on the page with a password field.
        
        
        
            0 
        
        
            1536 
        
                    posted 15 years ago by linusx
            Just thought id put up a version of my form validation class. It will be expanded in the future but I thought Id let everyone have a look.
# Update 0.1  #
    *   Create Error List Function
    *   Validate Email Address Function
    *   Valida...
        
        
        
            0 
        
        
            1399 
        
                    posted 15 years ago by alvincrespo
            Suppose you have a login form and you want to send the form when user press enter on his keyboard and not only by clicking on the submit button.
This can be achieved capturing a specific event when the user is typing. We have to capture the keypress...
        
        
        
            1 
        
        
            1919 
        
                    posted 15 years ago by ginoplusio
            Usage: 
//any element
window.onload = function(){
    focusFirstInput();
}
or 
// form elements under 'content-body'
window.onload = function(){
    focusFirstInput('content-body');
}
        
        
        
            0 
        
        
            1293 
        
                    posted 16 years ago by neoprolog
            JavaScritp Form Validation Framework to validate form fields on the fly, no programming knowledge required.
        
        
        
            0 
        
        
            1156 
        
                    posted 16 years ago by clickfind
            Click on an input field with a prefilled value, if that value equals the default then select it, if not leave it as it was. Relies on jQuery.
        
        
        
            2 
        
        
            1965 
        
                    posted 16 years ago by 1man
            I came across this little snippet... and thought it was rather nice.
        
        
        
            0 
        
        
            1231 
        
                    posted 16 years ago by gembry
            Use by inserting the following in the head.
		<script>
			$(document).ready(function() {
		  		$("input").toggleVal();
			});				
		</script>
        
        
        
            0 
        
        
            1463 
        
                    posted 17 years ago by davebowker
            this requires jquery.js, jquery.metadata.js, and jquery.validate,js
        
        
        
            2 
        
        
            1280 
        
                    posted 17 years ago by bcalloway
            Para validar si son dígitos, letras, números enteros o decimales (se puede seleccionar el separador de decimales). La función esDigito() y esLetra() está basada en otros códigos de Snipplr
        
        
        
            1 
        
        
            1046 
        
                    posted 17 years ago by sulfurito
            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 
        
        
            1185 
        
                    posted 17 years ago by dom111
            When there's a value in a textbox, like 'search', it disappears when you click on it, and reappears when you leave (blur) it. But only if you haven't filled in anything ofcourse.
Use it like this:
        
        
        
            1 
        
        
            958 
        
                    posted 17 years ago by jeppeb
            Name the form what ever you like, but make sure that is reflected in the javascript.
        
        
        
            0 
        
        
            5497 
        
                    posted 17 years ago by jachin
            Para realizar validaciones en Javascript rápidamente. Requiere que en la etiqueta  metamos un onSubmit="return checkform(this);" . Este trozo de código es para dos campos input con nombres campo1 y campo2.
        
        
        
            0 
        
        
            823 
        
                    posted 17 years ago by betacontinua
            using bgiframe to solve a bug in explorer: you cannot apply z-index to place divs over selects in a form!!!
        
        
        
            1 
        
        
            1539 
        
                    posted 17 years ago by victorchamorro
            For forms with a default value onload you don't want your users to have to select the value, delete it and then insert their own input.
This function focuses on a selected input, then it selects the default text so the user can easily type their o...
        
        
        
            1 
        
        
            1447 
        
                    posted 18 years ago by 1man
            Copy values from the first row of a column down the entire column.  This was used in a specific project, but the code could be helpful for other projects.
        
        
        
            1 
        
        
            1065 
        
                    posted 18 years ago by davaodude