You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In CakePHP 3 the kind of the confirmation message implementation supported newline charcters.
Now in CakePHP 4 it is not possible anymore to integrate newline characters or I simply don't know how.
In CakePHP 3 the following code:
<?= $this->Form->postLink(
'Delete',
['action' => 'delete', $article->id],
['confirm' => 'Text in the first line.\nSome text in the next line'])
?>
generated a JS dialog which supported newlines in the confirmation dialog, because the generated HTML was like:
<a href="#" onclick="if (confirm("Text in the first line.\nSome text in the next line")) { document.post_6560f918b6034460798220.submit(); } event.returnValue = false; return false;">Delete</a>
but now there will be generated the following piece of code:
<a href="#" data-confirm-message="Text in the first line.\nSome text in the next line" onclick="if (confirm(this.dataset.confirmMessage)) { document.post_6560f91ecb213856330014.submit(); } event.returnValue = false; return false;">Delete</a>
So what is the correct way to implement newlines in the messages or does the cakephp code has to be edited?
My current workaround is to replace all \n ind my confirmation messages with
CakePHP Version
4.5.1
PHP Version
8.2
The text was updated successfully, but these errors were encountered:
I personally have an overwritten FormHelper to adjust that postLink behavior with Sweetalert since its a much nicer modal than the default browser one.
If we can fix this new line behavior bug in Cake I am fine with putting that in, but in the end I would recommend everyone who needs more functionality from what the default Helpers provide to overwrite or even write their own Helpers to get exactly what they need.
For me those worked afaik, if those are actual newline characters, using " instead of ' in PHP.
But otherwise I would recommend using spaces for your case, or str_replace() those into spaces at runtime.
Description
In CakePHP 3 the kind of the confirmation message implementation supported newline charcters.
Now in CakePHP 4 it is not possible anymore to integrate newline characters or I simply don't know how.
In CakePHP 3 the following code:
generated a JS dialog which supported newlines in the confirmation dialog, because the generated HTML was like:
but now there will be generated the following piece of code:
So what is the correct way to implement newlines in the messages or does the cakephp code has to be edited?
My current workaround is to replace all \n ind my confirmation messages with
CakePHP Version
4.5.1
PHP Version
8.2
The text was updated successfully, but these errors were encountered: