Body: <p>Got a problem with a  module. It functions in Firefox and Chrome, but not in Safari. It seems that the action fired from the form doesn't even call the controller, the page just reloads.  Intentionally, I just placed a print statement <code>print_r($model-&gt;attributes)</code> in the controller's function. This should show the submitted attributes. As expected, in FF and Chrome, I see a <code>headers already sent error</code> when I submit the form. However, in Safari, there's not even an error. The page just reloads, as if it were ignoring the controller action.</p>
  <p>This is a simplified version of the form:</p>
  <pre class="lang-html prettyprint-override"><code>&lt;form  accept-charset=&quot;UTF-8&quot; method=&quot;POST&quot; action=&quot;&quot; &gt;
      &lt;input type=&quot;hidden&quot; name=&quot;CRAFT_CSRF_TOKEN&quot; value=&quot;U4gmSZvgfdI3XvZMb77IL3Xgn3mJcrW-cpnaCb_hPrduUInOA3Y_MjfHYC_MhAWDRQeCFlvwnXwdkfYKzECF5gfwjVvTkE_7CiLkrzQQa3c=&quot;&gt;
      &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;password-global/default/knock-knock&quot;&gt;
      &lt;input type=&quot;password&quot; name=&quot;theGreeting&quot; required value=&quot;&quot; /&gt; 
      &lt;button type=&quot;submit&quot;&gt;send&lt;/button&gt;   
  &lt;/form&gt;
  </code></pre>
  <p>And on the controller I have:</p>
  <pre class="lang-php prettyprint-override"><code>protected $allowAnonymous = ['index','knock-knock'];
  public function actionKnockKnock()
      {
          // creates model instance, populated with received parameters
          $model = new PasswordGlobalModel();
          // gets form's posted data and populates the model's attrib
          $model-&gt;attributes = Craft::$app-&gt;request-&gt;getBodyParams();
         
         // Action return
          if ( $model-&gt;validate()):
              // Sets cookies, redirects to page that made the request
              $this-&gt;makeCookie('shibboleth', 30);
              return $this-&gt;redirect($model-&gt;attributes['theCurrentPage']);
          else:
              // Reloads submit page, passing along error feedback (within the model)
              // adds model to the parameters so that it is available on the loaded page
              Craft::$app-&gt;urlManager-&gt;setRouteParams(['model' =&gt; $model]);
              // null forces redirection to page that made the request
              return null ;
          endif;
      }
  </code></pre>
  <p>Appreciate any input you have. This is driving me nuts!</p>
  <p><strong>EDIT 1</strong>
  Here's a screenshot of Safari's network request tab:</p>
  <p><a href="https://i.sstatic.net/nlH1M.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/nlH1M.png" alt="enter image description here" /></a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-11-23T09:54:55.047Z
Comments.Text: Have you checked the devtools (network tab) to see where Safari is sending the request? Is it hitting the correct endpoint, and what is the server returning there? If you can't see the network request because of the reload, activate the "Persist log" option to be able to inspect the network request for the fomr.
Comments.UserDisplayName: MoritzLost
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-11-23T13:50:25.220Z
Comments.Text: @MoritzLost, thanks for your help. After I send the form, the network tab shows a POST request to the same page where the form is ( a reload), which is what I expected: The controller action that is invoked processes the submitted data and then reloads the origin page with the controller's response. In Safari there isn't any listing of any form data sent with the request. In Firefox there's a dedicated tab for the form data sent with the request, so I can see my form's input. I haven't been able to check that in Safari.
Comments.UserDisplayName: mauricio
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-11-23T13:51:52.023Z
Comments.Text: @MoritzLost... the controller has a data validation step, so even, if Safari were sending an empty request, an error should be generated. But there isn't any type of error reported on the front end.
Comments.UserDisplayName: mauricio
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-11-23T13:56:08.317Z
Comments.Text: Safari displays the request data in the `Headers` tab at the bottom. See the screenshot here: https://imgur.com/z0ySPu5 Can you include a screenshot sent with the request in Safari?  
  If Safari isn't sending the request correctly, it won't include the action parameter, so your Controller won't be reached.
Comments.UserDisplayName: MoritzLost
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-11-23T13:58:45.817Z
Comments.Text: Other things I notice … the `password` input has a misspelling, `ame` instead of `name`. And the form doesn't have a `method` attribute, so it will use GET instead of POST by default.
Comments.UserDisplayName: MoritzLost
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-11-23T14:04:08.357Z
Comments.Text: @MoritzLost, just posted a screenshot of the request. And yes, you are right about the misspelling. The actual form does have the method and the proper spelling. When trying to post a simplified version of the form here, I made those mistakes.
Comments.UserDisplayName: mauricio
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-11-23T14:14:04.900Z
Comments.Text: The screenshot doesn't show the `Request data` part at the bottom (see my screenshot I linked above), is that cut off from the screenshot or is it not there for the request? If it's not there, that means Safari isn't sending the request correctly. In this case, maybe post the full template for the form, it's likely there's something wrong with the HTML. Or maybe it's related to the JS validation disabling the form inputs as it was in your last question?
Comments.UserDisplayName: MoritzLost
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-11-23T14:24:47.003Z
Comments.Text: @MoritzLost... yes, there's no Request Data.... Let me disable all the data validation and see what happens. I know last time's corrections are already in place. But maybe there's something else wrong with the JS.
Comments.UserDisplayName: mauricio
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-11-23T22:13:07.093Z
Comments.Text: @MoritzLost, oh Jesus, this is embarrassing. It was the same JS code as before. It seems that Safari it's pickier about it than FF & Chrome. In those 2 browsers, I was able to submit the form and then, right after, disable all the fields. *not possible* in Safari. The same routine prevents the sending of any data. The only way it works is I only disable the submit button and nothing else. Thank you so much for bearing with me!
Comments.UserDisplayName: mauricio
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-11-24T08:36:14.637Z
Comments.Text: Glad you got it working! In general, make sure you're comfortable with the devtools to debug issues like this, being able to tell if the request was sent correctly will help you narrow these issues down a lot.
Comments.UserDisplayName: MoritzLost
Tags: <modules>
Title: Form with controller action, not working on Safari only (!)
ThreadText: # Form with controller action, not working on Safari only (!)
  
  (Asked by: username_0 on 2021-11-23)
  
  Got a problem with a module. It functions in Firefox and Chrome, but not in Safari. It seems that the action fired from the form doesn't even call the controller, the page just reloads. Intentionally, I just placed a print statement `print_r($model->attributes)` in the controller's function. This should show the submitted attributes. As expected, in FF and Chrome, I see a `headers already sent error` when I submit the form. However, in Safari, there's not even an error. The page just reloads, as if it were ignoring the controller action.
  
  This is a simplified version of the form:
  
  ```html
  <form  accept-charset="UTF-8" method="POST" action="" >
      <input type="hidden" name="CRAFT_CSRF_TOKEN" value="U4gmSZvgfdI3XvZMb77IL3Xgn3mJcrW-cpnaCb_hPrduUInOA3Y_MjfHYC_MhAWDRQeCFlvwnXwdkfYKzECF5gfwjVvTkE_7CiLkrzQQa3c=">
      <input type="hidden" name="action" value="password-global/default/knock-knock">
      <input type="password" name="theGreeting" required value="" /> 
      <button type="submit">send</button>   
  </form>
  
  ```
  
  And on the controller I have:
  
  ```php
  protected $allowAnonymous = ['index','knock-knock'];
  public function actionKnockKnock()
      {
          // creates model instance, populated with received parameters
          $model = new PasswordGlobalModel();
          // gets form's posted data and populates the model's attrib
          $model->attributes = Craft::$app->request->getBodyParams();
         
         // Action return
          if ( $model->validate()):
              // Sets cookies, redirects to page that made the request
              $this->makeCookie('shibboleth', 30);
              return $this->redirect($model->attributes['theCurrentPage']);
          else:
              // Reloads submit page, passing along error feedback (within the model)
              // adds model to the parameters so that it is available on the loaded page
              Craft::$app->urlManager->setRouteParams(['model' => $model]);
              // null forces redirection to page that made the request
              return null ;
          endif;
      }
  
  ```
  
  Appreciate any input you have. This is driving me nuts!
  
  **EDIT 1**
  Here's a screenshot of Safari's network request tab:
  
  [![enter image description here](https://i.sstatic.net/nlH1M.png)](https://i.sstatic.net/nlH1M.png)
  
  **Tags:** modules
  
  > **Comments:**
  > **username_1**: Have you checked the devtools (network tab) to see where Safari is sending the request? Is it hitting the correct endpoint, and what is the server returning there? If you can't see the network request because of the reload, activate the "Persist log" option to be able to inspect the network request for the fomr.  
  > **username_0**: @username_1, thanks for your help. After I send the form, the network tab shows a POST request to the same page where the form is ( a reload), which is what I expected: The controller action that is invoked processes the submitted data and then reloads the origin page with the controller's response. In Safari there isn't any listing of any form data sent with the request. In Firefox there's a dedicated tab for the form data sent with the request, so I can see my form's input. I haven't been able to check that in Safari.  
  > **username_0**: @username_1... the controller has a data validation step, so even, if Safari were sending an empty request, an error should be generated. But there isn't any type of error reported on the front end.  
  > **username_1**: Safari displays the request data in the `Headers` tab at the bottom. See the screenshot here: https://imgur.com/z0ySPu5 Can you include a screenshot sent with the request in Safari?   If Safari isn't sending the request correctly, it won't include the action parameter, so your Controller won't be reached.  
  > **username_1**: Other things I notice … the `password` input has a misspelling, `ame` instead of `name`. And the form doesn't have a `method` attribute, so it will use GET instead of POST by default.  
  > **username_0**: @username_1, just posted a screenshot of the request. And yes, you are right about the misspelling. The actual form does have the method and the proper spelling. When trying to post a simplified version of the form here, I made those mistakes.  
  > **username_1**: The screenshot doesn't show the `Request data` part at the bottom (see my screenshot I linked above), is that cut off from the screenshot or is it not there for the request? If it's not there, that means Safari isn't sending the request correctly. In this case, maybe post the full template for the form, it's likely there's something wrong with the HTML. Or maybe it's related to the JS validation disabling the form inputs as it was in your last question?  
  > **username_0**: @username_1... yes, there's no Request Data.... Let me disable all the data validation and see what happens. I know last time's corrections are already in place. But maybe there's something else wrong with the JS.  
  > **username_0**: @username_1, oh Jesus, this is embarrassing. It was the same JS code as before. It seems that Safari it's pickier about it than FF & Chrome. In those 2 browsers, I was able to submit the form and then, right after, disable all the fields. *not possible* in Safari. The same routine prevents the sending of any data. The only way it works is I only disable the submit button and nothing else. Thank you so much for bearing with me!  
  > **username_1**: Glad you got it working! In general, make sure you're comfortable with the devtools to debug issues like this, being able to tell if the request was sent correctly will help you narrow these issues down a lot.  
  
  ---
  
  ## 0 answers
  
  