cancel
Showing results for 
Search instead for 
Did you mean: 

External 'js' files could not be included in SAPUI5 app - Getting SignaturePad is not defined error.

former_member195820
Participant
0 Kudos

Hi all,

I have implemented signature functionality in my UI5 app.I have used default Fiori MAster-Detail template available in WEBIDE. I was able to achieve signature pad when i run the app locally. Here's my project structure.

When I run the app from Overview page, I am not able to get that signature functionality.

It throws me an error stating "Uncaught ReferenceError: SignaturePad is not defined".

In my controller page also it shows error.

I have referred various blogs and tried including the code 1."com/work/manager/WorkManager/model/signature_pad.min" in component.js and

2. jQuery.sap.includeScript("https://cdnjs.cloudflare.com/ajax/libs/signature_pad/1.5.3/signature_pad.min.js", "id_signpad", onload, onerror);

3. jQuery.sap.includeScript("com.work.manager.WorkManager.model.signature_pad.min");

But nothing worked for me.. I am not able to call external 'js' files in my application.

Can someone help me with this?


Accepted Solutions (0)

Answers (2)

Answers (2)

ericci
Active Contributor

Is that a custom control or just a JS lib?

If it's a js lib you can include them inside your manifest.js as you would do with CSS file. Just look for the "resources" key and add to it:


"js": [ {"uri": "/your/lib/name.js" } ] 
former_member195820
Participant
0 Kudos

I have already done this.But even then i'm getting the same error. Here's the snapshot.

Is there any other alternative?

Thanks & regards,

Ramya

ericci
Active Contributor
0 Kudos

I think that you should just need to include inside your manifest file and access them as you would do in a normal web browser. You don't need to require another time that file.

So, just add them to the manifest and use the global variable that reference to the library directly (don't require them in your code).

Raj_Patel
Explorer
0 Kudos

gt.ramya dont put "./" simple use folder name and file name e.g "model/map.js"

Raj_Patel
Explorer
0 Kudos

it will run.. dont bother about component and call js on controller page...just use manifest.json file to load external files