uxsolutions / bootstrap-datepicker

A datepicker for twitter bootstrap (@twbs)
Apache License 2.0
12.66k stars 6.06k forks source link

Chrome and other browsers blocking post submits on server. #2616

Closed yanike closed 3 years ago

yanike commented 3 years ago

Expected behaviour

On submit, it should work like it does on local machine and navigates back to page using PHP with the data.

Actual behaviour

On submit, the browser blocks it with this error: [Deprecation] Resource requests whose URLs contained both removed whitespace (\n, \r, \t) characters and less-than characters (<) are blocked. Please remove newlines and encode less-than characters from places like element attribute values in order to load these resources. See https://www.chromestatus.com/feature/5735596811091968 for more details.

I've even tried removing the PHP code from the attributes and still gives me the error. I'm using WPE, which seems to always act different with some installs.

Datepicker version used

1.9.0

Example code

<div class="col-12 col-sm-6 col-md-4">
  <div class="input-group date">
    <input id="blog_date_after" name="blog_date_after" type="text" class="form-control input-field after-date" value="<?php echo $_REQUEST['blog_date_after']; ?>" autocomplete="off" placeholder="<?php if(isset($_REQUEST['blog_date_after']) && $_REQUEST['blog_date_after'] != ''){ echo $_REQUEST['blog_date_after']; } else { echo 'Blogs with date after'; } ?>" />
    <div class="input-group-addon">
      <span class="glyphicon glyphicon-th"></span>
    </div>
  </div>
</div>
<div class="col-12 col-sm-6 col-md-4">
  <div class="input-group date">
    <input id="blog_date_before" name="blog_date_before" type="text" class="form-control input-field after-date" value="<?php echo $_REQUEST['blog_date_before']; ?>" autocomplete="off" placeholder="<?php if(isset($_REQUEST['blog_date_before']) && $_REQUEST['blog_date_before'] != ''){ echo $_REQUEST['blog_date_before']; } else { echo 'Blogs with date before'; } ?>" />
    <div class="input-group-addon">
      <span class="glyphicon glyphicon-th"></span>
    </div>
  </div>
</div>
yanike commented 3 years ago

Issue was with the form action using this: action="<?php echo htmlspecialchars($_SERVER[‘PHP_SELF’]); ?>" changed it to action="" and it works