cancel
Showing results for 
Search instead for 
Did you mean: 

Debugging JS embedded in a form

cgiuliano
Champ in-the-making
Champ in-the-making
Hello everyone,
I'm struggling to find a convenient way to do debugging on the Java Script code embedded into the dynamic form controls' templates.

In  many FTL template for form controls (e.g. association.ftl) there is embedded JS to manage some kind of interaction. But when the form is <strong>dynamically</strong> generated by the page, I cannot find any way to reach and debug the included JS using FireBug.
For instance, the start-workflow page recall the form service to generate a form about the workflow to be started. How can I debug the code inside the form? I'm not able to find such code within FireBug.

What I'm still doing now is to call the form service in a separate browser tab, in order to make the code being visible (as if I make it pop up from the page). This is very uncomfortable, but the real pain is that I don't have all the external JS included, so that, for instance, the object-finder controls do not work. I cannot debug the interaction of the object-finder with other form controls, that is exactly what I'd need now.

Does anyone have a good advice on that?

Thank you!
Best regards,
Carlo
3 REPLIES 3

afaust
Legendary Innovator
Legendary Innovator
Hello,

it depends on how you load the form. If it is part of the page load, you should be able to debug it as any other embedded JavaScript using FireBug. The tricky part comes when the forms is part of a dialog which is loaded asynchronously. I am not really sure you can efficiently debug this with FireBug at all - the best bet here would be to simply add the breakpoints inside of the ObjectFinder JS source instead of trying to debug the embedded JS code.

Regards
Axel

cgiuliano
Champ in-the-making
Champ in-the-making
Thanks Axel for your comments.
They were helpful to make me understand something more about the form mechanism.
Maybe I can try to extract some JS code from the control template and run it from an external JS; then I should be able to debug it as you suggest for the ObjectFinder component.

Regards,
Carlo

muralidharand
Star Contributor
Star Contributor
Hi,
You can add "debugger" statement in the embedded javascript, and use the developer window / console to debug the javascript.