You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by elyes sallem <el...@gmail.com> on 2009/04/08 11:18:23 UTC

event onclick of nested:checkbox

Hello,
i have a checkbox to which i associated an event onclick
for this, i call a javascript function verifierReversible
here is the component call
<nested:checkbox property="CAjustTypeAjust" onclick="verifierReversible(<%=
Integer.parseInt(numLigne) %>)">
an here is the javascript function
function verifierReversible(i){
if
(document.forms[0].elements["ajustContrat["+i+"].CAjustTypeAjust"].checked==true){
document.forms[0].elements["ajustContrat["+i+"].CAjustTypeAjust"].value="R";
} else {
document.forms[0].elements["ajustContrat["+i+"].CAjustTypeAjust"].value=null;
}
}

the problem is that Integer.parseInt(numLigne)  is not replaced with its
value
any one has an idea?

Regards
Elyes*

*

Fwd: event onclick of nested:checkbox

Posted by elyes sallem <el...@gmail.com>.
it's ok now
here how to give the param
onclick='<%="verifierReversible("+Integer.parseInt(numLigne)+" )"%>' >


Regards
Elyes

---------- Forwarded message ----------
From: elyes sallem <el...@gmail.com>
Date: 2009/4/8
Subject: Fwd: event onclick of nested:checkbox
To: Struts Users Mailing List <us...@struts.apache.org>


here is the generated html code
                                        <input type="checkbox"
name="ajustContrat[0].CAjustTypeAjust" value="on"
onclick="verifierReversible(<%= Integer.parseInt(numLigne) %>)">

Regards
Sallemel



---------- Forwarded message ----------
From: elyes sallem <el...@gmail.com>
Date: 2009/4/8
Subject: event onclick of nested:checkbox
To: Struts Users Mailing List <us...@struts.apache.org>


Hello,
i have a checkbox to which i associated an event onclick
for this, i call a javascript function verifierReversible
here is the component call
<nested:checkbox property="CAjustTypeAjust" onclick="verifierReversible(<%=
Integer.parseInt(numLigne) %>)">
an here is the javascript function
function verifierReversible(i){
if
(document.forms[0].elements["ajustContrat["+i+"].CAjustTypeAjust"].checked==true){
document.forms[0].elements["ajustContrat["+i+"].CAjustTypeAjust"].value="R";
} else {
document.forms[0].elements["ajustContrat["+i+"].CAjustTypeAjust"].value=null;
}
}

the problem is that Integer.parseInt(numLigne)  is not replaced with its
value
any one has an idea?

Regards
Elyes*

*



-- 
Elyes.



-- 
Elyes.

Fwd: event onclick of nested:checkbox

Posted by elyes sallem <el...@gmail.com>.
here is the generated html code
                                        <input type="checkbox"
name="ajustContrat[0].CAjustTypeAjust" value="on"
onclick="verifierReversible(<%= Integer.parseInt(numLigne) %>)">

Regards
Sallemel


---------- Forwarded message ----------
From: elyes sallem <el...@gmail.com>
Date: 2009/4/8
Subject: event onclick of nested:checkbox
To: Struts Users Mailing List <us...@struts.apache.org>


Hello,
i have a checkbox to which i associated an event onclick
for this, i call a javascript function verifierReversible
here is the component call
<nested:checkbox property="CAjustTypeAjust" onclick="verifierReversible(<%=
Integer.parseInt(numLigne) %>)">
an here is the javascript function
function verifierReversible(i){
if
(document.forms[0].elements["ajustContrat["+i+"].CAjustTypeAjust"].checked==true){
document.forms[0].elements["ajustContrat["+i+"].CAjustTypeAjust"].value="R";
} else {
document.forms[0].elements["ajustContrat["+i+"].CAjustTypeAjust"].value=null;
}
}

the problem is that Integer.parseInt(numLigne)  is not replaced with its
value
any one has an idea?

Regards
Elyes*

*



-- 
Elyes.

Re: Fwd: event onclick of nested:checkbox

Posted by Charlesmel Carino <ch...@yahoo.com>.
Sallemel,

If you uncheck the box, you should have a javascript event on your page that iterates to your form
variables and re-assign a new value = "". Something like this 

document.form. CAjustTypeAjust = "".

Let me know if this works.




________________________________
From: elyes sallem <el...@gmail.com>
To: Struts Users Mailing List <us...@struts.apache.org>
Sent: Thursday, April 9, 2009 5:10:33 AM
Subject: Fwd: event onclick of nested:checkbox

Hello,
i have another problem with this checkbox
in fact , this checkbox can take two value : "R" or ""
if it is equal to "R", the checkbox is checked
else it is uncheckd
here is the code i imlemented :
<nested:checkbox property="CAjustTypeAjust" value="R"     />

and in tha actionForm i added a reset method , where i affect the type to ""

    public void reset(ActionMapping mapping, HttpServletRequest request) {
        if (!ajustContrat.isEmpty()) {
            for (Iterator<AjustContrat> iterator = ajustContrat.iterator();
iterator.hasNext();) {
                AjustContrat ajustContrat = (AjustContrat) iterator.next();
                ajustContrat.setCAjustTypeAjust("");
                }
            }
    }
but the problem is that , if i have a checked checkbox, and i uncheck it , i
expect that its takes "" as value, but i take the old value "R"
and if i have an unchecked checkbox, if i check it, i expected it takes "R"
as value, but its takes the old value ""

any one has an idea how to solve this problem?

Regards
Sallemel


---------- Forwarded message ----------
From: elyes sallem <el...@gmail.com>
Date: 2009/4/8
Subject: event onclick of nested:checkbox
To: Struts Users Mailing List <us...@struts.apache.org>


Hello,
i have a checkbox to which i associated an event onclick
for this, i call a javascript function verifierReversible
here is the component call
<nested:checkbox property="CAjustTypeAjust" onclick="verifierReversible(<%=
Integer.parseInt(numLigne) %>)">
an here is the javascript function
function verifierReversible(i){
if
(document.forms[0].elements["ajustContrat["+i+"].CAjustTypeAjust"].checked==true){
document.forms[0].elements["ajustContrat["+i+"].CAjustTypeAjust"].value="R";
} else {
document.forms[0].elements["ajustContrat["+i+"].CAjustTypeAjust"].value=null;
}
}

the problem is that Integer.parseInt(numLigne)  is not replaced with its
value
any one has an idea?

Regards
Elyes*

*



-- 
Elyes.

Fwd: event onclick of nested:checkbox

Posted by elyes sallem <el...@gmail.com>.
Hello,
i have another problem with this checkbox
in fact , this checkbox can take two value : "R" or ""
if it is equal to "R", the checkbox is checked
else it is uncheckd
here is the code i imlemented :
<nested:checkbox property="CAjustTypeAjust" value="R"     />

and in tha actionForm i added a reset method , where i affect the type to ""

    public void reset(ActionMapping mapping, HttpServletRequest request) {
        if (!ajustContrat.isEmpty()) {
            for (Iterator<AjustContrat> iterator = ajustContrat.iterator();
iterator.hasNext();) {
                AjustContrat ajustContrat = (AjustContrat) iterator.next();
                ajustContrat.setCAjustTypeAjust("");
                }
            }
    }
but the problem is that , if i have a checked checkbox, and i uncheck it , i
expect that its takes "" as value, but i take the old value "R"
and if i have an unchecked checkbox, if i check it, i expected it takes "R"
as value, but its takes the old value ""

any one has an idea how to solve this problem?

Regards
Sallemel


---------- Forwarded message ----------
From: elyes sallem <el...@gmail.com>
Date: 2009/4/8
Subject: event onclick of nested:checkbox
To: Struts Users Mailing List <us...@struts.apache.org>


Hello,
i have a checkbox to which i associated an event onclick
for this, i call a javascript function verifierReversible
here is the component call
<nested:checkbox property="CAjustTypeAjust" onclick="verifierReversible(<%=
Integer.parseInt(numLigne) %>)">
an here is the javascript function
function verifierReversible(i){
if
(document.forms[0].elements["ajustContrat["+i+"].CAjustTypeAjust"].checked==true){
document.forms[0].elements["ajustContrat["+i+"].CAjustTypeAjust"].value="R";
} else {
document.forms[0].elements["ajustContrat["+i+"].CAjustTypeAjust"].value=null;
}
}

the problem is that Integer.parseInt(numLigne)  is not replaced with its
value
any one has an idea?

Regards
Elyes*

*



-- 
Elyes.