voyent
Calling iceSubmitPartial from javascript  XML
Forum Index -> General Help
Author Message
brevleq

Joined: 31/May/2010 08:52:03
Messages: 9
Offline


Hi icefaces community!
I hope you can understand my poor english.

I have a specific situation where I need call icefaces from a javascript code. This specific situation is a chart generated by Pentaho BI Server. The chart is generated with a link to a javascript code that is called when a user clicks the chart.
The unique function of this javascript is call a specific java bean method.

I'm trying this to comunicate to the server but I don't have any sucess:
Code:
 jQuery.noConflict();
             function drillDown(parameter){
                 var localForm=jQuery("[id*=form]");
                 var localInput=jQuery("[id*=drillParameter]");
                 if(localInput != null){
                     localInput.value = parameter;
                     if(localForm != null){                  iceSubmitPartial(localForm,localInput,MouseEvent.CLICK);
                     }
                 }
             }
 


I followed this topic without the same lucky:
http://www.icefaces.org/JForum/posts/list/7605.page

when I click in the chart, this error returns from firebug:

e.tagName is undefined
http://geotech97:21897/Cogitare/xmlhttp/1278447290228/icefaces-d2d.js
Line 22

I did something wrong??
venu_dvmr

Joined: 30/Sep/2008 00:00:00
Messages: 58
Offline


You can use either of these options

1. Have a hidden input element with ValueChangeListiner. Use JavaScript to set the value of the hidden input element which internally calls the Event on the backing bean.

2. Have an Hidden Input button that has ActionEvent or Action and use JQuery trigger() method to call the event on the button.

Hope this workout.
brevleq

Joined: 31/May/2010 08:52:03
Messages: 9
Offline


Thank you very much venu_dvmr!

I choose your first option:
1. Have a hidden input element with ValueChangeListiner. Use JavaScript to set the value of the hidden input element which internally calls the Event on the backing bean.  


but to make it work I separated the inputHidden in another form and called javascript submit.

Code:
 <ice:form id="drillForm">
                 <ice:inputHidden id="drillParameter" valueChangeListener="#{chartTab.switchItem}"/>
             </ice:form>


Code:
 
 function drillDown(parameter){
                 var input=document.getElementById("drillForm:drillParameter");              
                 var drillForm=document.getElementById("drillForm");              
                 input.value=parameter;              
                 drillForm.submit();
             }
 
sjscabert


Joined: 10/Nov/2010 09:08:58
Messages: 16
Offline


I have a variation on this approach (#1) that I'm trying to get working, and its intent is to logout a session behind the scenes if the user closes the browser. I have code similar to the above:

<script type='text/javascript'>
function logoutOnClose()
{
var logoutElem = document.getElementById("logout");
if (logoutElem)
return true;
else
{
var formElem = document.getElementById("logoutForm");
alert("form is "+formElem);
var input=document.getElementById("logoutForm:logoutHidden");
alert("input is "+input);
input.value="newValue";
formElem.submit();
return true;
}
}
</script>

<ice:form id="logoutForm">
<ice:inputHidden id="logoutHidden" valueChangeListener="#{sessionManager.processLogout}"/>
</ice:form>

In the above code, processLogout is never called. Any ideas as to why?

Shawn Bertrand, Principal Software Developer
HARRIS CORPORATION | RF Communications Division
assuredcommunications™
 
Forum Index -> General Help
Go to:   
Powered by JForum 2.1.7ice © JForum Team