How to get a wr:AjaxURL tag working

22 Aug '13, 10:21 PM
63,443 Views
Forum Forum Starter - Level 2

This is the continuation of my ongoing question (Dynamic Link Labelling)[http://forum.webratio.com/questions/671/dynamic-link-labelling-for-custom-unit].

I moved it to this thread because it's now specifically about getting a AjaxURL tag in a Custom Unit style sheet to work (and no about getting the Label to display correcty as per the past post). Hope this helps people.

The compilation error is about the <wr:AjaxURL> tag, where the "context" attribute is the variable used to locate the link.

My IFML looks like: image?Snippet showing 'Like' example of Custom Unit

As per the last entry on the previous forum item:

  • the "link" variable is correctly referring the link outgoing from the unit.
  • As per the image below, the operation chain is being followed correctly. I have two examples of my Custom Control trilogy (the actuate, the save and the display) on the one popup, and both do what they should and receive the correct input parameters in each case.
  • I get a compilation error on the "onclick" code as suggested (see code below), but if I exclude it the pages work as they should except instead of re-freshing only the Ajax popup, the browser does a full GET or POST and the popup page now fills the entire browser pane.

When the "onclick" and AjaxURL is not included it operates like: image?WebRatio working without Ajax refresh

(here's the full style unit code)[https://dl.dropboxusercontent.com/u/11776886/CustomStyleUnit.txt]

So the question is now, why do I get a compilation error (in the style sheet of the custom unit)?

So reiterating, if I have the following code in the link:

 onclick="<wr:AjaxURL context="link" type="button"/>"

I get this compilation error:

com.webratio.commons.transform.EvaluateException: Undefined Link Context: Unable to find the link in the specified context [context = link/.].
[occurred at line 11 in AjaxURL.template]

using the link defined as you suggest

                <input title="<c:out value="${<wr:UnitId/>.signInputLabel}"/>" onclick="<wr:AjaxURL context="link" type="button"/>" type="submit" id="button:<wr:Id context="link"/>" name="button:<wr:Id context="link"/>" value="<c:out value="${<wr:UnitId/>.signName}"/>"/>

As asked, the code of the link is only inserted in the custom template. There is only the single custom template. The behaviour described about is that where there is no <wr:AjaxURL> tag or onclick tag in the button tag. As mentioned, when I put that suggested "onclick" code in the input button tag it doesn't compile.

I did read the API description of the <wr:AjaxURL> tag and it did mention I needed it wrapped in an iterator tag? I did try hacking an iterator around the single link var but didn't have any luck.

Finally, in previous help it was suggested to create a link that was hidden. I think that this could be the problem and I have not set this up correctly. When I try to include the "hide" definition for the link I'm not getting the same IDE options presented. This weekend I will install the latest WebRatio and try building a Custom Unit and single page website from new. I'll post if I have success, or any variation in defining the link and hiding it as previously sugggested.

Thanks.

 
x 1
Follow
Answer Answer at this question and get points!
No Forum Badges

Hi,

I applied your style unit code to a sample custom Form Based unit and I obtained only a generation error related to the "unitLink" property not found. This property is used in the wr:AjaxURL tag (line 196), but it's not defined. By adding the variable definition (in the starting part of the template), such as for example

 def unitLink = unit.selectSingleNode("layout:Link[@name='Link1']");
 // where "Link1" is the link outgoing from my custom unit

the isn't the generation error. Then, by removing the <c:if> tags, I can see the form with the buttons in the page.

You should try to add the declaration of the "unitLink" variable.

In case the problem persists, to replicate and better understand the problem, it should be useful to have a small sample project that reproduces the error. You can for example create a new project (e.g based on Acme) and then copy-paste the pages from your project to the sample one.

Did you have any change by building a Custom Unit and single page website from new (with the latest version of WebRatio), as you said ?

   
x 1
Forum Starter - Level 2

Hi, Well ... I have it working! :D Mostly!

So, in my code snippet there were two link declarations:

 def link = unit.selectSingleNode("layout:Link");
 def unitLink = unit.selectSingleNode("layout:Link[@name='Link1']");

In relation to your comments:

  • There were two link declarations, link and unitLink. Remember, this is a generic implementation so the template can not be coded to a specific link. Either way, both link declarations work in the cut down version. (btw - in WebRatio 7.2 it's 'Flow1' and not 'Link1').
  • I upgraded from version 7.0.5 to 7.2
  • The cut-down test case is firing from a standard page, not a Ajax popup page.

The results look like:

Snippet showing 'Like' example of Custom Unit

So there is still a problem to get past ... why is the first instantiation of the button not being overwritten. Every subsequent click refreshes the custom control button over the top of the old one (as is desired)?

I'll also re-implement my solution now in version 7.2 and see if the navigation link still works when it is on a popup page and not on just a normal page.

 
x 1
Answer at this question and get points!

Related questions

404 on generated app page 500 error with WebRatio BPM 502 proxy error-generate and run Admin area disabled aggiornamento fallito a causa di un errore interno Ajax and FCK Editor (WebRatio 5.x) ajax and javascript AJAX events problem to external JavaScript Ajax is not working in own style project Ajax link success callback? Ajax onchange and jQuery 2.x (with migrate plugin) incompatible Ajax on change selection field and modify units Ajax web app with javascript history object using the WebRatio Any sample deployment Autocomplete template Cannot invoke method putAll() on null object Cannot invoke method selectSingleNode() on null object Can't run any aplication Code is exceeding the 65535 bytes limit error on JBOSS Como abrir una ventana en ajax desde una master page Como usar la función autocomplete en un field Compare with the current time Component computation com.webratio.struts.exceptions.WRSecurityException: Invalid request target host Connection refused. Custom Unit and AJAX / SOAP Database connection, Host and Port number DB in Data Service Project Debug configuration Dependencies installation error Disabilitare campi durante evento AJAX error activating student account Error deploying WAR against to JBOSS Error updating metadata process Error when updating to WR 7.2.3 Filtros Caracteres Especiales Find Model Problemas Format currency forward/backward navigation and bookmark in ajax web app From BPM to WebProject - BUILD FAILED Generation errors on ajax enabled page with many components, ajax links and selective refresh "Generation Error" with Generate and Run Groovy script numer after an error HelloWorld Unit sample code Help with math unit. Debug mode says error as result code Hiding form components based on page conditions Hierarchy component How to add an image in a modal/pop-up window? how to delete this error? How to keep current page/block of List/Hierarchy (Index) components after ajax link clickwith selective refresh? How to localize AJAX waiting dialog? How to open a window ajax in a BPM activity? How to use LandmarkMenu as AJAX navigation how to use the landmark menu as AJAX navigation i can't install mobile version on windows I can't install Webratio on my Desktop (Ubuntu 13.04 x64) I can't run any application with WebRatio (Table/View 'APP.POST' does not exist) Installation with java 1.8 Installazione Macosx invio mail fallito java.lang.NullPointerException javascript history object java virtual machine error Job not start correctly JSP/DO issues on Tomcat 5.5 (Ubuntu) Login Error mandatory control code parameter is missing Mensaje: the selection cannot be launched and there are no recent launches Missing plugin emulation support error Missing units when importing project Multi Selects didn't work in update page Next Activity Note property - Error synchronizing with web project No access to protected site view with Login No Apache Derby driver found No database on my cloud account Page Home - First time the Project Web begins Problema al generar y ejecutar proyecto Problema generazione codice Problema Grafo da una lista gerarchica Problema ¨HTTP Status 404" Problemas con el Operations View Delete Problem: Compile Failed problemi installazione su Mac sistema operativo OSX El Capitan problem on first deploy with webratio Problems to connect Sql Server DB from Webratio Problem syncing reports Problem to run an Application Problem with application runnung Problem with execution of webratio Problem with ireport Problem with the deletion of more than 50.000 records in a table Progress bar when uploading big file(s) in a form? Project cannot be opened with WebRatio Community Platform Sample web application Scroll ajax problem selection fields on cascade Selezione sul giorno "Events Planning" Showing items that have a relation with an entity Solve "Generation Error" with Generate and Run option Student reserved area, download error Table 'freeapp43.profesion' doesn't exist Tomcat external session store and WebRatio webapp. "Unable to close sub-context ..." Unable to compute the controller URL(s) for applicationUnable to compute the controller URL(s) for application having status PROVISIONING Unable to connect to Internet Unable to execute the script java.lang.NullPointerException Unable to find Cloud free function Unable to get ExpenseReport example work in WebRation Personl 7.2.2 Unable to instantiate a new application instance Unable to update the web project Unspecified BPM Engine Database Update fields based on selection of other fields Updating attributes of an entity User Login Timestamp Uso de la componente chart de webRatio Webratio Add-ons no permite login Web Ratio Add-ons shop not working WEBRATIO LINUX AT EXECUTION TIME Web Ratio Mobile plateform Macos Sierra Web Ratio Mobile - Remote data mapping problem When execute my web application I have this error: returned a null bean wr-ajaxDivs break layout on ajax pages. XPCOM Error