Buy now!

NinjaForms

This is a form sample using all common actions in web applications (read, write, enable, disable).

HTML

                        

JS

                        function enableDisableForm() {
                            var frm = $("#frmSample");
                            if (frm.hasClass('disabled'))
                                frm.enableAll();
                            else
                                frm.disableAll();
        
                            frm.toggleClass('disabled');
                        }

                        function readForm() {
                            var model = $("#frmSample").readForm();
                            $("#txtModel").val(JSON.stringify(model));
                        }

                        function writeForm() {
                            try {
                                var model = eval("(" + $("#txtModel").val() + ')');
                                $("#frmSample").writeForm(model);
                            }
                            catch (e) {

                            }
                        }

                        function validateForm() {
                            if ($("#frmSample").valid()) {
                                ninjaModal({
                                    title: 'Success',
                                    html: 'This form is validated!',
                                    width:300
                                });
                            }
                            else {
                                ninjaModal({
                                    title: 'Error',
                                    html: 'This form is NOT validated!',
                                    width: 300
                                });
                            }
                        }

                        function clearForm() {
                            $("#frmSample").clearForm();
                        }