使用正确的DOM节点表单值

时间:2015-08-24 20:59:40

标签: javascript jquery forms

我使用工作脚本为我的页面创建帐户。现在我想将此脚本与jquery向导插件结合使用。所以我不能再使用this.form选择器了,因为我在另一个函数中工作(或者我至少错误地认为这个想法)。可悲的是,我没有得到该功能的价值。

如果有人需要整个脚本/来源:http://beta.juuin.com/site/first_review/first_review.php

工作脚本的一部分:

<input id="btn" type="button" value="Send" onclick="return
regformhash(this.form, this.form.email,
this.form.password, this.form.confirmpwd);" />

使用regformhash():

function regformhash(form, email, password, conf) {var p = document.createElement("input");
form.appendChild(p);
p.name = "p";
p.type = "hidden";
p.value = hex_sha512(password.value);
password.value = "";
conf.value = "";
form.submit();
return true;}

新脚本的一部分是jquery步骤:

var form_wizard = $("#registration_form").show();

   form_wizard.steps({
        headerTag: "h3",
        bodyTag: "fieldset",
        transitionEffect: "slideLeft",
        onStepChanging: function (event, currentIndex, newIndex)
        {
            // Allways allow previous action even if the current form is not valid!
            if (currentIndex > newIndex)
            {
                return true;
            }
            // Forbid next action on "Warning" step if the user is to young

            // Needed in some cases if the user went back (clean up)
            if (currentIndex < newIndex)
            {
                // To remove error styles
                form_wizard.find(".body:eq(" + newIndex + ") label.error").remove();
                form_wizard.find(".body:eq(" + newIndex + ") .error").removeClass("error");
            }
            form_wizard.validate().settings.ignore = ":disabled,:hidden";
            return form_wizard.valid();
        },

        onFinishing: function (event, currentIndex)
        {
            form_wizard.validate().settings.ignore = ":disabled";
            return form_wizard.valid();
        },
        onFinished: function (event, currentIndex)
        {

        return regformhash2(form, form.email, form.password, form.confirmpwd)

            form_wizard.submit();

        return true;
        }
    }).validate({
        errorPlacement: function errorPlacement(error, element) { element.before(error); },

    });

表格标签

<form role="form" id="registration_form" method="post"
 name="registration_form" action="<?php echo esc_url($_SERVER['PHP_SELF']); ?>">

0 个答案:

没有答案