javascript error when adding a custom block to the page
Permalink
I've built the most basic block imaginable... just 1 text box. No inline editing. Site caching is disabled. I have it installed but for some reason whenever I attempt to add it to the page I get a javascript error:
This isn't happening with any of the built-in system blocks, and I can't see anything in my code that would lead me to believe there's an error of some kind. I'm totally stumped here... anyone have any ideas?
(Attached is the block code)
Uncaught Error: Syntax error, unrecognized expression: <script type="text/javascript"> </script> <div data-container="inline-toolbar"> <form method="post" action="http://localhost:8888/mytestproject/httpdocs/ccm/system/dialogs/p…d_block/submit?ccm_token=1437443787:8906d4bbc8b280c8a3fc18cd6810cbc9&cID=1" id="ccm-block-form" enctype="multipart/form-data" class="validate"> <input type="hidden" name="btID" value="39"> <input type="hidden" name="arHandle" value="Header Top Left Text"> <input type="hidden" name="cID" value="1"> <input type="hidden" name="dragAreaBlockID" value="0" /> <div> <div class="form-group"> <label for="text" class="control-label">Text</label> <input type="text" id="text" name="text" value="" class="form-control ccm-input-text" /></div> </div> <!-- we do it this way so we still trip javascript validation. stupid javascript. //--> <input type="submit" name="ccm-add-block-submit" value="submit" style="display: none" id="ccm-form-submit-button" /> </form>
Viewing 15 lines of 16 lines. View entire code block.
This isn't happening with any of the built-in system blocks, and I can't see anything in my code that would lead me to believe there's an error of some kind. I'm totally stumped here... anyone have any ideas?
(Attached is the block code)
h is a security function
No errors for me either, installs and works correctly. No PHP or Javascript errors.
Weird, seems like something to do with your environment.
Weird, seems like something to do with your environment.
Thanks for the help guys. It must be something with my environment, but unfortunately I don't have the time to figure it out. Oh well, back to 5.6 for me. Maybe one of these days I'll have some success with 5.7 :-/
@jordanlev
It would be a shame to see you give up on 5.7. Especially since it has improved so much since you last used it.
It would be a shame to see you give up on 5.7. Especially since it has improved so much since you last used it.
If it's any help at all, I'm on Windows and your block installed fine and I added it to the page without any errors in the page or logs.
Hey everyone,
I'm pretty sure my problem was caused by other javascript issues in the markup I was given (which was unfortunately not the best -- you know how off-the-shelf themes can be sometimes).
But thank you all for taking the time to try out the block and let me know that it worked under normal circumstances.
As for the "h" function, that is a shortcut for htmlspecialchars (or more specifically for C5's Loader::helper('text')->entities() function, which is a wrapper around htmlspecialchars) -- it's a common shortcut in several php frameworks, because it saves a lot of typing for a very frequently-used function.
I'm pretty sure my problem was caused by other javascript issues in the markup I was given (which was unfortunately not the best -- you know how off-the-shelf themes can be sometimes).
But thank you all for taking the time to try out the block and let me know that it worked under normal circumstances.
As for the "h" function, that is a shortcut for htmlspecialchars (or more specifically for C5's Loader::helper('text')->entities() function, which is a wrapper around htmlspecialchars) -- it's a common shortcut in several php frameworks, because it saves a lot of typing for a very frequently-used function.
@jordanlev
Good to hear that you sorted out the problem.
Good to hear that you sorted out the problem.
I installed your block and it works as expected. There are no errors.
I checked the files and everything looks right. The only thing I didn't recognize was the h() function used in view.php, but it didn't cause a problem.
I found one reference in the concrete5 install to "we do it this way so we still trip javascript validation. stupid javascript" in this file:
C:\xampp\htdocs\concrete5\concrete\views\dialogs\page\add_block.php
This appears to be a jQuery error:
I have never encountered this problem before with concrete5.
Are you using a fresh install?
Are you using a custom theme?
Have you added any additional JavaScript files anywhere?