serializearray()不接受表单字段

时间:2018-03-20 17:04:35

标签: php jquery

我有index.php文件,它存储用户注册的表单。但每当我尝试显示存储在serializeArray中的数据时,它都表示它是空的。这是我的html表单代码:

public void start(View view){

String id;
EditText animalIdEditText = findViewById(R.id.animalIDsearch);
String animalId = animalIdEditText.getText().toString();
FirebaseFirestore db = FirebaseFirestore.getInstance();
DocumentReference docRef = db.collection("Animals").document(animalId);
docRef.get().addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
    @Override
    public void onSuccess(DocumentSnapshot documentSnapshot) {
        Animal animal = documentSnapshot.toObject(Animal.class); // this is where I create animal object. It doesn't let me declare it above either.
    }
});

    Intent intent = new Intent(this, searchActivity.class);
    intent.putExtra("Animal",animal); // error in this line : animal  can't be resolved
    startActivity(intent);
}

在我的index.js中,我有一个函数来输入所有输入的表单字段并将它们存储在serializeArray中。

<form method="post" id="signupForm">
    <div class="modal fade" id="signupModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="signupModalLabel">Sign Up</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
                </div>
                <div class="modal-body">

                    <div class="alert alert-danger" id="signupAlert" role="alert">
                        This is a danger alert—check it out!
                    </div>
                    <div class="form-group">
                        <label for="username">Username</label>
                        <input type="text" class="form-control" id="username" placeholder="Username" maxlength="30">
                    </div>
                    <div class="form-group">
                        <label for="email">Email</label>
                        <input type="email" class="form-control" id="email" placeholder="Email address" maxlength="50">
                    </div>
                    <div class="form-group">
                        <label for="password">Choose a Password</label>
                        <input type="password" class="form-control" id="password" placeholder="Password" maxlength="30">
                    </div>
                    <div class="form-group">
                        <label for="passwordConfirm">Confirm Password</label>
                        <input type="password" class="form-control" id="passwordConfirm" placeholder="Confirm Password" maxlength="30">
                    </div>

                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                    <input class="btn btn-primary" name="signup" type="submit" class="btn btn-primary" value="Sign Up">
                </div>
            </div>
        </div>
    </div>
</form>

数组结果显示没有值。我试图控制日志任何字符串,以查看我是否已正确链接我的index.js文件到index.php,它的工作原理。将表单字段放入数组只会出现问题。

  

[] length:0 proto :数组(0)

0 个答案:

没有答案