1

There's a strange issue with a legacy CraftCMS backend we've inherited. On the backend I am unable to submit forms that update the entries, in fact the SAVE button does nothing.

Upon investigation it seems as though some whitespaces are being omitted in the code, for example:

<formid="main-form" method="post" accept-charset="UTF-8">.....</formid="main-form">

The space between form and id="main-form" is missing. If I manually add this space by editing the DOM, the form will submit successfully.

In addition any controls that need to be instantiated in jQuery (for example the asset selection control) also have whitespace missing and try to do

newCraft.AssetSelectInput({"id":"fields-newsImage"});

rather than

new Craft.AssetSelectInput({"id":"fields-newsImage"});

My Craft and Environment look like this:

PHP version 7.4.15
OS version Linux 4.14.219-161.340.amzn2.x86_64
Database driver & version PostgreSQL 11.10
Image driver & version GD 7.4.15
Craft edition & version Craft Solo 3.1.22
Yii version 2.0.17
Twig version 2.8.1

Any advice would be greatly appreciated.

  • Did you find a solution, I have the same issue. But only on my home page, a single entry. – Laurence Cope Aug 31 '21 at 15:45
  • I managed to fix my home page by adding a space in the file app/fieldtypes/AssetFieldType for "protected $inputJsClass = ' Craft.AssetSelectInput';". But this issue appears in various other fields and files. Should really work back to where this is output. – Laurence Cope Aug 31 '21 at 16:05
  • Space is being stripped after new in this line: {% includejs %} new {{ jsClass }}({{ jsSettings|json_encode|raw }}); {% endincludejs %} – Laurence Cope Aug 31 '21 at 16:10

1 Answers1

0

Could be something with character encoding -- your new environment not recognizing the whitespace character being used as a space. Take a look at the files in an editor that will show you everything including non-printable characters -- "cat -v" should do it.