cancel
Showing results for 
Search instead for 
Did you mean: 

Where to place our custom client side javascript File?

vikash_patel
Star Contributor
Star Contributor

Hi,

I have created a custom javascript file. Which have methods

 function myFunction(){
var x = document.forms["leadDetasilsform"]["leadName"].value;
if (x == "") {
alert("Name must be filled out");
return false;
}
}
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

I have created a Button in dashlet's ftl file and on this button click i have to call a function. 
How to use/import separate js file for the form validation created in webscript?

At which location should I put my js for the form validation?

2 REPLIES 2

afaust
Legendary Innovator
Legendary Innovator

It is up to you where to place the file. You just need to import it with the correct path either via a Surf extension module dependency customisation or a configuration as a form dependency. Maybe you should re-read your certification preparation material, the documentation about writing dashlets, or some of the examples.

As for hooking in a function for form validation, it completely depends on how you build the form. From your previous questions I assume you are writing a completely custom form without using any of the capabilities that Alfresco already provides, so it is completely up to you...

Thanks Axel,
Now,I am thinking that I would have to re-read my certification preparation material again.
I tried many times to import external js to my ftl file. But i can't get result.