Friday 7 October 2016

JQuery on a form that sends to submit once all the fields are filled out


                              // All sections have been filled out
                // After this we'll then reveal the next section.

                $("#edit-field-supplier-email-und-0-email").focusout(function(e){
                    // has all fields got data in.  If so lets move on
                    if ( $("#edit-field-supplier-email-und-0-email").val() != '' && $("#edit-field-company-name-und-0-value").val() != '' && $("#edit-field-phone-number-und-0-value").val() != '' && $("#edit-field-post-code-und-0-value").val() != '' && $("#edit-field-supplier-email-und-0-email").val() != ''){

                        // prefill postion placing
                        $("#edit-field-position-reached-und-0-value").val(1);

                        $("#supplier-node-form").submit();

                    }

                });