How to pass a JSP var to a Script function called in a netui:checkbox

How to pass a JSP variable to a Java Script function called in a netui:checkbox onSelect?
I have a requirement where based on the checkBox selected or deselected in a repeater tag I would have to select or deselect other checkboxes in a netui:form. I am trying to pass the index or unique name of the checkbox to the JavaScript function. When I try this code I am getting a Syntax Error!! and getting a " item undefined" in the javascript. This works when I use just the html form tag but when I use the <netui:form> tag I am facing this issue. Any help would be highly appreciated.
function selectACheckBoxOnClick(name) {
alert ("called selectACheckBoxOnClick ");
alert ("called name "+name);
<netui-data:repeater dataSource="{pageFlow.unregisteredContractAssetsDTOArr}">
<netui-data:repeaterItem>
<% String checkboxName = "selectACheckBox_"+i;
String serialNum = "serialNum_"+i;
String hidenboxName = "hiddenACheckBox_"+i;
String loopNo = new Integer(i).toString();
System.out.println("Loop String :"+ loopNo);
System.out.println("CheckBox Name:"+ checkboxName);
System.out.println("serialNum :"+serialNum); %>
<tr bgcolor="#ffffff">
<td align="center">
<netui:checkBox dataSource="{container.item.selectedAssetFlag}" onSelect="selectACheckBoxOnClick(<%=checkboxName%>);" tagId="<%=checkboxName%>"/>
</td>
          <td class="small"><netui:label value="{container.item.model}"/></td>
          <td class="small">
<netui:hidden dataSource="{container.item.splitAssetNo}" tagId="<%=serialNum%>"/>
<netui:label value="{container.item.serial}"></netui:label></td>
          <td class="small"><netui:label value="{container.item.equpimentId}"/></td>
          <td class="small">
<netui-data:getData resultId="siteId" value="{container.item.siteNo}" />
<%String siteId = (String) pageContext.getAttribute("siteId");%>
<netui:anchor action="getSiteLevelAssets" formSubmit="true">
<netui:parameter value="{container.item.siteNo}" name="siteNo" />
<netui:label value="{container.item.siteNo}" />
</netui:anchor>
</td>     </tr>
<%i++;%>
</netui-data:repeaterItem>
</netui-data:repeater>
This code works within a form:
               <td align=center>
                    <input type=image name="unassign" onclick="javascript:unassignReplacement(<%=replacementSupply.getPMSupplyId()%>)" src="<%=request.getContextPath()%>/images/bt_sm_x.gif" border=0 alt="Unassign">
                    </td>
Thanks,
Salome

hi
i did not go thru your code completly
but u can use the following for your problem
the checkbox in the repeater must have unique TagID
counter = 0; (initialize)
<netui-data:repeaterItem>
<netui:checkBox dataSource="" tagId='<%="count"+String.valueOf(counter)%>' onClick="some function()" />
<%counter++;%>
</netui-data:repeaterItem>
here if u have 3 checkbox
They will have Tagid's as count1 , count2 and count3
now in the javascript somefunction()
use the following line
for(j=0;j<<%=counter%>;j++)
document.forms(0)[getNetuiTagName"count"+j)].checked=false;     
}

Similar Messages

  • How to pass a jsp variable into javascript??

    <p><%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
    <p><%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
    <p><html>
    <p><c:set var="binrmapi" value="http://localhost/paas-api/bingorooms.action;jsessionid=XXXXXX?userId=TEST2&sessionId=1&key=1" />
    <p><c:import var="testbinrm" url="${fn:replace(binrmapi, 'XXXXXX', jsessionid)}"/>
    <p><c:set var="tuples" value="${fn:split(testbinrm, '><')}" />
    <p>Time until next game
    <p><c:forEach var="tuple" items="${tuples}">
    <p><c:if test="${fn:contains(tuple, 'row ')}">
    <p> <p><code>
    <p> <c:set var="values" value="${fn:split(tuple, '=\"')}" />
    <p> <font color="blue">
    <p> <c:out value="${values[17]}" />
    <p><c:set var="remainingtime" value="${values[17]}" />
    <p> </font>
    <p> </code>
    <p></c:if>
    <p></c:forEach>
    <p><form name="counter"><input type="text" size="8" name="d2"></form>
    <p><script>
    <p>var milisec=0
    <p>var seconds=eval("document.myForm.remaining").value;
    <p>function display(){
    <p> if (milisec<=0){
    <p> milisec=9
    <p> seconds-=1
    <p>}
    <p>if (seconds<=-1){
    <p> milisec=0
    <p> seconds+=1
    <p> }
    <br>else
    <p> milisec-=1
    <p> document.counter.d2.value=seconds+"."+milisec
    setTimeout("display()",100)
    <p>}
    <p>display()
    <p></script>
    <p></body>
    <p></html>
    <p>This is my code that i was working on, in the jsp part of the script, i get a api call and save a value of time in the variable remainingtime.. and in the javascript, i try to have a countdown clock counting down the remaining time.. but i guess it doesnt work.. how can i get that working? thanks alot
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001

    Re: How to pass a jsp variable into javascript??Here is the sameple one, hope it will solves your problem.
    <html>
    <body>
    <form name=f>
    <%!
    String str = "A String"
    %>
    <script>
    var avariable = <%=str%>
    <script>
    </form>
    </body>
    </html>
    Let me know if you face any problem

  • How can I access JSP variables from a JavaScript function in a JSP page?

    Respected sir
    How can I access JSP variables from a JavaScript function in a JSP page?
    Thanx

    You may be get some help from the code below.
    <%
        String str="str";
    %>
    <script>
        function accessVar(){
           var varStr='<%=str%>';
           alert(varStr);// here will diplay 'str'
    </script>

  • How to pass column name at run time in function.

    how to pass column name at run time in function as parameter.
    thank in advance
    pramod patel

    Hello,
    Using dynamic sql you can pass column name to function. well I am not getting what you really want to do ? Please write in more detail. By the way I am providing one example here. see it uses dynamic sql.
    Create or replace function fun_updtest (p_columnname_varchar2 in varchar2,
    p_value_number in number)
    return number is
    v_stmt varchar2(500);
    begin
    v_stmt := 'update emp
    set '||p_columnname_varchar2||' = '||to_char(p_value_number)||'
              where empno = 7369';
    execute immediate v_stmt;
    return 0;
    commit;
    end;
    call to this function can be like this..
    declare
    v_number               number;
    begin
    v_number := fun_updtest('SAL',5000);
    end;
    Adinath Kamode

  • How to get the value retruned by java script function into my jsp page

    Hai all,
    I had a particular java script function which returns a date.
    function getDate() {
         var sDate;
    // This code executes when the user clicks on a day in the calendar.
    if ("TD" == event.srcElement.tagName)
    // Test whether day is valid.
    if ("" != event.srcElement.innerText)
    //alert(event.srcElement.innerText);
    sDate = document.all.year.value + "-" + document.all.month.value + "-" + event.srcElement.innerText;
    document.all.ret.value = sDate;
    var mahi=window.open("configurexml.jsp?xyz=document.all.ret.value")
    return sDate;}
    Now i want to display this particular date in my jsp page. can anyone tell me the correct approach or a sample code to diaplay this date in my jsp page.
    <%@ page language="java"
    import="javax.xml.parsers.*,java.io.*,org.w3c.dom.*"%><%@ page import="java.util.*" %>
    !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html> <head> <title>Configuring Xml File</title>
    <SCRIPT LANGUAGE="JavaScript" SRC="xyz.js"> </SCRIPT>
    body bgcolor="#d0d0d0" onClick= "return getDate()" >
    <form name="f1">
    <b>20 october 2006 </b>
    Here where i am printing the date i had to get the value from the js function. how to do that. plz help me....

    Are you talking about server-side java code (servlets/jsp) or client side (applet)? Given we are in the JSP forum I'll assume we're talking server side.
    If so, you are making a common but fundamental mistake. JavaScript executes on the client, not on the server. If you want client data on the server it has to get there somehow. The simplest way to do this in JSP land is via HTTP. So... have your JavaScript code call a JSP (or servlet) and pass the value you want as a URL parameter. Of course this will also change the browser location, so if you don't want this to happen use a frame or iframe to capture your HTTP request.
    For example:
    Javascript....
    function someFunction() {
    return 1;
    var value = someFunction();
    location.href="somejsp.jsp?value=" + value;

  • How to pass multiple values from workbook to planning function ?

    Hi,
    I have created Planning function in Modeler and it has one parameter(Variable represents = Multiple single values).
    When executing the planning function by create planning seq. in the web template : I see value of variable store data like ...
        A.) input one value -> V1
        B.) input three values -> V1;V2;V3
    This function execute completely in web.
    However, I want to use the planning function in workbook(Excel).
    The value of variable can't input V1;V2;V3... I don't know how to pass multiple values from workbook to parameter(Multiple single values type) in planning function ?
    thank you.

    Hi,
    Please see the attached how to document (page no 16).
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0881371-78a1-2910-f0b8-af3e184929be">how to</a>
    Hope this was helpful
    thanks

  • How to pass a shell variable to rman scripts

    I want to backup datafile to different directory
    depending on the current time,and I can do this to
    pass a shell variable to rman scripts,and this
    variable will used as part of format ,like this:
    backup incremental level=0
    tag rman_inc0_bck
    filesperset 5
    format '$(DIR)/rman_fulldb_%u_%s_%p_%d'
    (database include current controlfile)
    and $(DIR) is shell variable ,but rman will not
    recognize this ,how to achieve this?

    You could send your script to rman thru a pipe | or <<
    echo "backup incremental level=0
    tag rman_inc0_bck
    filesperset 5
    format '$(DIR)/rman_fulldb_%u_%s_%p_%d'
    (database include current controlfile);" | rman target /You could also create a "temp script" and then use it from rman with cmdfile
    sed "s,XXXDIR,$(DIR)," yourtemplate > /tmp/rmanscript.$$
    rman target / cmdfile /tmp/rmanscript.$$
    rm /tmp/rmanscript.$$

  • How to passed an xsl parameter to a javascript function inside an xsl styel

    Hi:
    I am having problem passing an xsl param variable as a parameter to a javascript function inside an
    xsl styelsheet.
    Here is my xsl stylesheet.
    >
    <xsl:param name="numberOfRecordsFromDatabase" select="search-result/rec-num" />
    <xsl:template name="Body">
    <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"
    onLoad="cloneHeader();window.parent.shrinkIFrame(<xsl:value-of select='$numberOfRecordsFromDatabase'/>);"
    onresize="cloneHeaderResize();window.parent.shrinkIFrame(<xsl:value-of select='$numberOfRecordsFromDatabase'/>);">
    </body>
    </xsl:template>
    I am trying to pass a variable called numberOfRecordsFromDatabase to
    a javascript function called window.parent.shrinkIFrame(<xsl:value-of select='$numberOfRecordsFromDatabase'/>).
    Is this possible?
    If not, is there a way to do this.
    Any hint would be greatly appreciated.
    Yours,
    Frustrated.

    I would do it like this:
    Load the "search-result/rec-num" value into a field within an invisible div tag:
    <div id="miscproperties" style="visibility:hidden">
       <input id="numberOfRecs" type="text">
          <xsl:attribute name="value">
             <xsl:value-of select="search-result/rec-num"/>
          </xsl:attribute>
       </input>
    </div>Then, your js function can retrieve the value via
    var x = document.getElementById("numberOfRecs").valueR. Grimes

  • How to pass multi value selection parameter to SAP Function Module?

    Hi ,
    Anyone know how to pass CR multi value parameter - array to SAP Function module ?
    eg  multi selection of customer in CR
    and then pass to Function module
    in SAP FM,  the SQL select these customer only
    How should the import parameter / table of SAP Function module designed?
    and how should CR pass the data to SAP FM
    thx
    John

    Moved to Integration Kit forum

  • How to pass default value of argument to stored function?

    Hi,
    in procedure I don't have to pass all arguments, because I set it with name, but in stored function I have to set arguments with index som I must set all arguments. Some arguments have default value. So how to pass default value?
    thx for any comments

    It really helps me if someone tell me that it isn't possiblle.
    thx.

  • How to pass a command into Telnet Play Script dynamically?

    I'd like to pass a command into Telnet Play Script dynamically. Could I do it?
    Thank you.

    Jim,
    I've attached a vi just to show how I send a command to my gateway using Telnet Write.vi. Actually this command changes speed on entered port of my gateway. Port number is changeable. I have question: could I send this command using Telnet Play Script.vi instead of Telnet Write.vi? If Yes - then How?
    Tank you
    Attachments:
    script1.vi ‏10 KB

  • Error passing a remote object in a rmi function call

    Hi,
    I've a problem passing an UnicastRemoteObject extended object in a rmi function call. I get the following error
    java.lang.IllegalArgumentException: argument type mismatch
    I've 2 Remote Objects: GalaxyRegistration and Station. I want to pass a Station Object as argument in a function from GalaxyRegistration. Does anyone know what the problem is?
    Here is the code:
    public class GalaxyRegistration
    extends UnicastRemoteObject
    implements GalaxyRegistrationInterface, Galaxy {
         public GalaxyRegistration() throws RemoteException {
         public void add(Station station) throws RemoteException {
              stations.addElement(station);
              System.out.println("Add Station " + station.getName());
    public class Station
    extends UnicastRemoteObject
    implements StationInterface {
         SystemInfo system;
         public Station(String name, String description, Coordinate position, Profile profile)
    throws RemoteException {
              system = new SystemInfo(name, description, position, profile);
    public class StationServer {
         Station station;
         public void run() {
              // create new Station
              System.out.println("Create new Station:");
              // register and bind new station
              try     {
                   station = new Station(name, descr, location, profile);
                   System.out.println("Station created ...");
                   GalaxyRegistrationInterface registry =
                             (GalaxyRegistrationInterface)
                             Naming.lookup
    ("//localhost/GalaxyRegistration");
                   System.out.println("Registry looked up ...");               
                   // >>>>>>>> NEXT LINE IS THE ERROR LINE <<<<<<<<<<<<<<     
                   registry.add(station);
              } catch(Exception e) {
                   System.out.println(e);
    }

    regardless of any other problems in your code, neither of the objects which you are subclassing from UnicastRemoteObject call the superclass constructor, which is a pretty basic flaw - in this case, it will lead to neither of these objects being exported properly.

  • How to pass one JSP form to next JSP ?

    i am using the two JSPs. i want to pass the form name of the first JSP to the second JSP and then assign the form name to second JSP form

    i have tone JSP file which is will be added to any JSP... This is my requirement.
    So i want to get the parent JSP form name and asign to the this JSP form name ... so that this code will be Generic

  • What and How to pass Line Num (or ID) to a function?? (from OM Or der Line: "Line Flo

    Greetings, and thanks in advance for any advice you can provide.
    I'm looking at the predefined Workflow "OM Order Line" and a process in it called "Line Flow - Configuration". We're wanting to pass the Line Number (or Line ID) from the Workflow to a custom function, at a specific place in the WF that we've identified. The only attribute that looks at all relevant to pass is "AFAS_Line_ID".
    I've duplicated the "Line Flow - Configuration" process, and created a test notification to display the contents of "AFAS_Line_ID" when the workflow is run, but the value of "AFAS_Line_ID" always appears to be empty/blank/null whenever I create an order the generate the lines. "AFAS_Line_ID" also appears to be empty/null when viewing the attributes behind the WF process, at any and every step in the process.
    The attribute "AFAS Line ID" seems like the only thing even remotely related to what we need to pass, as all the other attributes are things like User ID, App ID, Responsibily ID, OM WF Admin, Org ID, Lead Time Rollup Org, Lead Time Rollup Config Item, Lead Time Date, Lead Time Category Struction, Line Catagory, Lead Time Attribute Reg ID, Lead Time Request ID, Line Short Descriptor, and Notification Approver.
    How can we pass a reference to the current line being processed within the workflow, and specifically - WHAT should we be passing??
    Thanks again for your help, preferably much sooner than later. -- Tom Buck
    [email protected], or post replies here to this forum.

    Tom
    I can only answer in terms of workflow technology. It is possible that there are item attributes that exist which you can use in some SQL to derive the real value you are looking for. For example, there might exist an Item Attribute with the Primary Key for the row you are looking for, and you write some SQL to get the column form that row. You can use the wf_engine.GetItemAttr APIs to get Item Attribute values for a given work item.
    Cheers
    Mark
    Greetings, and thanks in advance for any advice you can provide.
    I'm looking at the predefined Workflow "OM Order Line" and a process in it called "Line Flow - Configuration". We're wanting to pass the Line Number (or Line ID) from the Workflow to a custom function, at a specific place in the WF that we've identified. The only attribute that looks at all relevant to pass is "AFAS_Line_ID".
    I've duplicated the "Line Flow - Configuration" process, and created a test notification to display the contents of "AFAS_Line_ID" when the workflow is run, but the value of "AFAS_Line_ID" always appears to be empty/blank/null whenever I create an order the generate the lines. "AFAS_Line_ID" also appears to be empty/null when viewing the attributes behind the WF process, at any and every step in the process.
    The attribute "AFAS Line ID" seems like the only thing even remotely related to what we need to pass, as all the other attributes are things like User ID, App ID, Responsibily ID, OM WF Admin, Org ID, Lead Time Rollup Org, Lead Time Rollup Config Item, Lead Time Date, Lead Time Category Struction, Line Catagory, Lead Time Attribute Reg ID, Lead Time Request ID, Line Short Descriptor, and Notification Approver.
    How can we pass a reference to the current line being processed within the workflow, and specifically - WHAT should we be passing??
    Thanks again for your help, preferably much sooner than later. -- Tom Buck
    [email protected], or post replies here to this forum.

  • How to put a jsp variable into a javascript function?

    Please read the following coding. I want to pass the variable ans from jsp to the function check_answer() of javascript. ans is a string got from database. But I cannot put the variable ans into the Javascript function. Can anyone help?
    <script language="Javascript">
    function check_answer() {
    if (testing.result.value==ans ){
    window.alert("You have got 10 marks.");
    </script>
    <body>
    <form name="testing"...>
    <%
    ResultSet rs = stmt.executeQuery("select * from level where...");
    while(rs.next())
    out.println("<tr>");
    out.println("<td>" + rs.getString("question") + "</td>");
    ans = rs.getString("answer");
    out.println("</tr>");
    out.println("<input type='text' name='result'>);
    out.println("<input type='button' value='Enter' onclick='check_answer()'>");
    %>

    The following should be able to pass ans.
    <script language="Javascript">
    function check_answer(ans) {
    if (testing.result.value==ans ){
    window.alert("You have got 10 marks.");
    </script>
    <body>
    <form name="testing"...>
    <%
    ResultSet rs = stmt.executeQuery("select * from level where...");
    while(rs.next())
    out.println("<tr>");
    out.println("<td>" + rs.getString("question") + "</td>");
    ans = rs.getString("answer");
    out.println("</tr>");
    out.println("<input type='text' name='result'>);
    out.println("<input type='button' value='Enter' onclick='check_answer('<%= ans%>')'>");
    %>jag

Maybe you are looking for