Skip to main content

Hello,

i need to import custom JavaScript & Style in order to drag drop image to pdf .

my custom code work correctly please check index.zip file that contain original source code .

26760iF345137ABCA2A0A8.png

 

so I created 3 datalabel and I put my code inside datalabel  (style ,html code ,scripts)

26761i194AAC2E4B53F565.png

 

but when run the form no errors appear in console and (custom code also not appear )

26762i5B4F249F4D33B6C2.png

  also I using style profile method and same issue  (custom code also not appear )

Hi @Akhanjer ,



 



I was able to get this working.



 



There were a few issues when initially porting everything over, and might be good to note going forward when injecting JS/CSS into a K2 SmartForm:



 





  • There were comments starting with //. When injecting these and whitespace is removed, the first comment will comment out all the succeeding code. So be sure to either remove the comments, or comment /*like this*/.


  • There was an import of jQuery - K2 smartforms is based on jQuery, so you do not need to import it again, in fact it causes issues if the versions do not match up.


  • There were lines of JavaScript that do not end with a semi-colon(;). As with the comments issue above, due to whitespace being removed, it'll cause a JS error, so be sure to terminate your code properly.




 



To get it working I added 3 data labels, 1 for JS, 1 for CSS, and 1 for HTML. Make sure they are all set to literal.



 



I have attached the values I used for each (you can use an expression to add the values or transfer the values using a rule). The basic functionality seems to work fine, and there are no errors, there are just a few CSS issues you'll need to sort out.



 



Please let me know if you have questions.



 



Regards,



Ernie


thank you Erine,



I did the same steps but still not working 


@Akhanjer 



 



Please check if there are any errors in the console, if there are, please send a screenshot.



 



Also please send a screenshot of your form and the properties of the three datalabels to help with troubleshooting.



 



Cheers,



Ernie


no any error in the console , (k2 make my style not appearing )



 



 



   


hi,



 



also I changed (Css & JS) data Labe visible false but still not working .


Reply