Jump to content

Enabling front-end editing give me an error


manlio
 Share

Recommended Posts

Hi! I have a problem using front-end editing PW capabilities. I'm using the latest legacy version and I have enabled it, but when I'm in frontend (logged as admin) I get this error in Chrome console

Uncaught ReferenceError: ProcessWire is not defined
    at ckeLoadPlugins (InputfieldCKEditor.js?v=157-1475222106:17)
    at InputfieldCKEditor.js?v=157-1475222106:22

I tried to disable some modules but it still doesn't work.

Anyone have a suggestion how to fix this problem?

Thank you!

Link to comment
Share on other sites

  • 2 weeks later...

I know this is a little late and it shouldn't happen when using the built-in front-end editing, but when I use frontend forms that need some core js, like AsmSelect fields, since PW 3, I now need to do this to define "ProcessWire" in js.

<script type="text/javascript">
<?php $jsConfig = $config->js(); ?>
  var ProcessWire = {config: <?php echo json_encode($jsConfig); ?>};
</script>

 

  • Like 3
Link to comment
Share on other sites

Thank you adrian, your reply is still helpful because I started working on other things and I didn't find time to investigate more on this (it is not mandatory).

I have added the script in the header and now the error message has changed in

Uncaught TypeError: Cannot read property 'plugins' of undefined
    at ckeLoadPlugins (InputfieldCKEditor.js?v=157-1475222106:17)
    at InputfieldCKEditor.js?v=157-1475222106:22
ckeLoadPlugins @ InputfieldCKEditor.js?v=157-1475222106:17
(anonymous) @ InputfieldCKEditor.js?v=157-1475222106:22

Thank you as usual for your amazing support.

As soon as I can work on this I will try to remove some javascript to see if something change.

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...
On 2/18/2017 at 5:04 AM, adrian said:

I know this is a little late and it shouldn't happen when using the built-in front-end editing, but when I use frontend forms that need some core js, like AsmSelect fields, since PW 3, I now need to do this to define "ProcessWire" in js.


<script type="text/javascript">
<?php $jsConfig = $config->js(); ?>
  var ProcessWire = {config: <?php echo json_encode($jsConfig); ?>};
</script>

 

Thank you for this very valuable piece of information.

After implementing this in the head I still got a JS error: ReferenceError: config is not defined.

I had to adjust the code like this to make it work:

<script type="text/javascript">
<?php $jsConfig = $config->js(); ?>
  var ProcessWire = {config: <?php echo json_encode($jsConfig); ?>};
  var config = ProcessWire.config;
</script>

No idea why my frontend form didn't pick up config from the ProcessWire object. 

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...