I wonder if someone could tell me how to set a sessionScope parameter using client-side javascript (or perhaps propose an easier way to accomplish what I am trying to achieve)?
I have a sessionScope parameter called “customerName” (sessionScope.customerName).
I have calculated the appearance and value of a number of design elements based on this parameter.
I also have a Combo Box control on the page that pulls the valid customer names from the database and allows me to select from the list.
What I would like to do in this case is add logic behind the onChange event of the Combo Box to set the sessionScope.customerName value to the name selected in the Combo Box (nothing to do with setting field values on an underlying document).
I followed John Mackey’s advice (http://www.jmackey.net/groupwareinc/johnblog/johnblog.nsf/d6plinks/GROC-7GLFZG) and tried to execute the server-side script from the client-side, with limited results.
I am having two issues in particular that I am hoping someone can help me with…
I am using script such as:
var newName = document.getElementById(“selectCustomer”)
However, although I have given the Combo Box an ID of “selectCustomer”, I can never initialize a handle to that element.
To test, I instead used the code:
var newName = “Test Customer”;
var test = “#{javascript:sessionScope.customerName='”+newName+“'}”;
That presents my second issue.
Instead of the sessionScope parameter assuming the new value (“New Customer”), it instead assumes the value: “+newName+” (inc the quotes).
I know I am royally screwing up something here, and have probably taken the wrong route to accomplish what should be an easy task.
Can anyone give me some advice to help me along?
Thanks in advance for any such assistance!
T.