简体   繁体   中英

Renaming a PHP file enables jquery form validation?

This is a very odd problem. I have a signup form, signup.php, which uses the jQuery validate plugin to validate it.

Twice in last 2 months, the form serialization abruptly failed (see code below) and no input values get submitted regardless of what I put in them. The weird part is if I simply rename the signup.php file (eg, to signup0.php) then the form serialization works again and the form validates. My signup.php file is included in my main template.php file using the following code:

PHP

<? include $_SERVER['DOCUMENT_ROOT'] . '/application/views/forms/signup.php';?>

JS:

beforeSubmit:function(formData, $form, options)
  var thisFormData = $.param(data.formData); 
  console.log('live data: ' + thisFormData); 
  //this yields no data regardless of what I enter in any of the input fields
  //subsequently $($form).validate() fails

Does anyone have any clue what is going on here? I also have a login.php form included in this template.php file which never suffers this problem. This has to be a PHP rather than a JS problem since renaming the PHP file can correct it, right? The only thing I can think is that multiple hidden instances of signup.php are being created somehow but that seems like the thoughts of a crazy person.

Chrome设置->清除数据..但是,如果它在其他浏览器上重现,我认为它不会对您有所帮助。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM