Javascript and html

24 May '16, 10:19 PM
13,986 Views
Forum Forum Starter - Level 1

Hi i have a code in html that contains javascript my question is how can i show my page in webratio and pass my variables with flows.

i tried modifiyng the template but i dont know where to put the javascript code for example to use groovy you start your code like this [%

I hope you can help me thanks a lot

 
x 0
Follow
Answer Answer at this question and get points!
Forum Expert - Level 8

Hi,

the proper way to do it is the following:

  1. copy the javascript file library (if any) in a folder of the style project
  2. declare the resource in the Layout.xml file of the style project , assigning a unique name to it (eg. myJS)
  3. in the template file, state that the template requires that javascript library using the wr:RequireResource tag (e.g. <wr:RequireResource ref="myJs"/> )
  4. write the JavaScript code that uses the library as you do in a HTML page

The <wr:Resource> tag prints all the necessary resources in the page.
The needed resources are automatically calculated at generation time by WebRatio.
This means that, everytime you use the template requiring the myJs resource, the tag is able to understand it and prints the reference in the generated page.

I suggest you to download some templates from the WebRatio Addons to see how they are written.
Some of them require JavaScript, so you can see how they are done.

   
x 0
Forum Expert - Level 8

Hi,

JavaScript code must be executed at runtime by the application.
So you must embed the code in the resulting page.
This can be done just copying the JavaScript code and pasting it inside the template.
The [%%] delimiters must be used for Groovy code, which is executed at generation time (which means when you press the Generate and Run button.

 
x 0
Forum Starter - Level 1

hi thanks for your time my problem is: i copy my javascript code in the template under the label:

<wr:Resources types="javascript"/>

but when i run the project it doesnt read that part should i put the code in another part? im starting with my learning in style hope you can help me thanks a lot

 
x 0
Answer at this question and get points!

Related questions

2 grids inside one/same cell result in non-selectable 2nd grid Access page variable in a page template add html Ajax is not working in own style project Ajax web app with javascript history object using the WebRatio Alimentar graficas con base de datos Alternate way to get current User Oid in layout template groovy script? Any way to localize the Tab Grid Template (Webratio Store)? Applicare un template ad un Web Project Ayuda Simple List Component Layout personalizado Bootstrap Style Button to go on another page Cambiare dimensioni bottoni - Change button size Can I inject html into custom unit template?! Change color template bootstrap style Change Style Changing the login page does not work ckeditor - change directory for the browser Colore Attributi index unit Dinamico - Index unit dynamic attribute color Como abrir una ventana en ajax desde una master page Como embeber un video subido desde archivo ? Como mostrar una imagen de portada arriba del menu? Como mostrar una imagen en una lista o en la componente detalles? Confirm Dialog Customize layout mobile platform Custom Tooltip Position Default error pages default login page Display contents of a URL Dynamic link labelling for Custom Unit Error in Excel Unit - Font size Export to a HTML/CSS/JS project Field as link soruce File CSS non considerato in generazione Form element Form template Get date pattern Get home page from template Google map is not shown properly in the tab grid Guardar Saltos de LINEA HelloWorld Unit sample code Hiding landmarks (or flows) when the user is logged in How can i create pagemenu or landmarkmenu with multiple levels. How can I modified the htmls files to perform my style How to add an image in a modal/pop-up window? How to include a template into other template? How to localize AJAX waiting dialog? How to localize the multi message unit in the notification layout How to modify template? How to modify the FertileEnviroment Default page How to remove default Linked Resources? How to use LandmarkMenu as AJAX navigation how to use the landmark menu as AJAX navigation integrate framework to webratio mobile Integrazione javascript javascript history object Localize "Welcome..." and "Process details" logo webratio meaning of each tag in the XML code (Show XML/Show Layout XML) modify field html Modify html generated by wr:NavigationBar Pages Problem After Project Generation pass template variable Problem Login Form only if user not logged Problem print Problems with the page refresh (Tab Grid) Problem with adding templates query unit who to hide fields that are used in a link Recursive Hierarchical Index Unit Style Tree Redirect to the default module Remove default BPM css import for all templates Responsive Bootstrap Grid Responsive Layout Manager Set context parameter Simple Static Page Standard confirm dialog replacement Style hierarchical unit help!! Supoort for Mobile and Desktop display Target tabs in Tab Grid Control Tooltip on a field Too much layout parameters = no scroll in parameters config window Uppercase Use image as interaction flow Vista de diferentes Site Views Webratio Add-ons no permite login wr-ajaxDivs break layout on ajax pages.