You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Benz <be...@yahoo.com> on 2007/10/10 05:19:20 UTC

html:select javascript onchange passing parameter problem

this is my part of jsp:
....
<logic:iterate id="loop" indexId="idx" name="data">
....
  <html:select name="loop" property="sts_1" onchange="checkStsCombo(this,
'hasil_1', '<%=idx%>');">
  ...
  </html:select>
...
</logic:iterate>
...

I get the html result:
...
  <select name="sts_1" onchange="checkStsCombo(this, 'hasil_1',
'<%=idx%>');">
...

The '<%=idx%>' text in jsp should be rendered as the value of idx valu which
is such as '0','1',etc.
Can anybody tell me why it doesn't works?

Best Regards,

Benz
-- 
View this message in context: http://www.nabble.com/html%3Aselect-javascript-onchange-passing-parameter-problem-tf4598318.html#a13128698
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: html:select javascript onchange passing parameter problem

Posted by Benz <be...@yahoo.com>.
which part do you mean? Is this?
<html:form action="projection.do">
...
  <logic:iterate id="loop" indexId="idx" name="data">
  ...
    <td class="celBorder">
      <html:select name="loop" property="sts_1"
onchange="checkStsCombo(this, 'hasil_1', '<%=idx%>');">
        <html:option value=""></html:option>
        <html:options collection="listSts" property="value"
labelProperty="description"/>
      </html:select>
    </td>
    <td class="celBorder" valign="top">
      <html:text indexed="true" name="loop" property="hasil_1" size="3"/>
    </td>
    ...
  </logic:iterate>
  ...
</html:form>
...
<script>
  ...
  var validStatus = new Array ("PCB","PCS","PCK","RC");
  function checkStsCombo(combobox, fieldName, idx) {
    var index = combobox.selectedIndex;
    var selected = combobox[index].value;
    var name = 'loop[' + idx + '].' + fieldName;
    var valid = false;
    for (i = 0; i < validStatus.length; i++) {
      if (validStatus[i] == selected) {
        valid = true;
        break;
      }
    }
    if (valid) document.getElementById(name).readonly = true;
    else document.getElementById(name).readonly = false;
  }
</script>

The main problem is why i can't get the '<%=idx%>' value? it should be
rendered as integer value (i.e. '0','1',etc) in the html file.



Ravindar T wrote:
> 
> where are getting the values for select either from bean or  request
> attribute.
> 
> 
> 
> On 10/10/07, Benz <be...@yahoo.com> wrote:
>>
>>
>> this is my part of jsp:
>> ....
>> <logic:iterate id="loop" indexId="idx" name="data">
>> ....
>>   <html:select name="loop" property="sts_1" onchange="checkStsCombo(this,
>> 'hasil_1', '<%=idx%>');">
>>   ...
>>   </html:select>
>> ...
>> </logic:iterate>
>> ...
>>
>> I get the html result:
>> ...
>>   <select name="sts_1" onchange="checkStsCombo(this, 'hasil_1',
>> '<%=idx%>');">
>> ...
>>
>> The '<%=idx%>' text in jsp should be rendered as the value of idx valu
>> which
>> is such as '0','1',etc.
>> Can anybody tell me why it doesn't works?
>>
>> Best Regards,
>>
>> Benz
>> --
>> View this message in context:
>> http://www.nabble.com/html%3Aselect-javascript-onchange-passing-parameter-problem-tf4598318.html#a13128698
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 
> -- 
> Ravindar T
> Developer Analyst,
> HotCourses Ltd,
> ravindar.t@hotcourses.co.in
> 
> 

-- 
View this message in context: http://www.nabble.com/html%3Aselect-javascript-onchange-passing-parameter-problem-tf4598318.html#a13130785
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: html:select javascript onchange passing parameter problem

Posted by Ravindar T <op...@gmail.com>.
where are getting the values for select either from bean or  request
attribute.



On 10/10/07, Benz <be...@yahoo.com> wrote:
>
>
> this is my part of jsp:
> ....
> <logic:iterate id="loop" indexId="idx" name="data">
> ....
>   <html:select name="loop" property="sts_1" onchange="checkStsCombo(this,
> 'hasil_1', '<%=idx%>');">
>   ...
>   </html:select>
> ...
> </logic:iterate>
> ...
>
> I get the html result:
> ...
>   <select name="sts_1" onchange="checkStsCombo(this, 'hasil_1',
> '<%=idx%>');">
> ...
>
> The '<%=idx%>' text in jsp should be rendered as the value of idx valu
> which
> is such as '0','1',etc.
> Can anybody tell me why it doesn't works?
>
> Best Regards,
>
> Benz
> --
> View this message in context:
> http://www.nabble.com/html%3Aselect-javascript-onchange-passing-parameter-problem-tf4598318.html#a13128698
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Ravindar T
Developer Analyst,
HotCourses Ltd,
ravindar.t@hotcourses.co.in

RE: html:select javascript onchange passing parameter problem

Posted by Sindhu C R <si...@asladvancedsys.in>.
I cld nt still fix it..
Let me no if u cld proceed.



Regards,
Sindhu C.R

 Please don't print this Email unless you really need to - this will preserve trees on planet earth. 
===========================================================================================

-----Original Message-----
From: Mahawilai [mailto:orn_orn_@hotmail.com] 
Sent: Tuesday, May 20, 2008 9:26 AM
To: user@struts.apache.org
Subject: Re: html:select javascript onchange passing parameter problem


I have the same problem, Please tell me how to fix it if you know how.

thank you very much

Mahawilai


Benz wrote:
> 
> this is my part of jsp:
> ....
> <logic:iterate id="loop" indexId="idx" name="data">
> ....
>   <html:select name="loop" property="sts_1" onchange="checkStsCombo(this,
> 'hasil_1', '<%=idx%>');">
>   ...
>   </html:select>
> ...
> </logic:iterate>
> ...
> 
> I get the html result:
> ...
>   <select name="sts_1" onchange="checkStsCombo(this, 'hasil_1',
> '<%=idx%>');">
> ...
> 
> The '<%=idx%>' text in jsp should be rendered as the value of idx valu
> which is such as '0','1',etc.
> Can anybody tell me why it doesn't works?
> 
> Best Regards,
> 
> Benz
> 

-- 
View this message in context: http://www.nabble.com/html%3Aselect-javascript-onchange-passing-parameter-problem-tp13128698p17332762.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


No virus found in this incoming message.
Checked by AVG. 
Version: 8.0.100 / Virus Database: 269.23.21/1455 - Release Date: 5/19/2008 5:04 PM


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: html:select javascript onchange passing parameter problem

Posted by Mahawilai <or...@hotmail.com>.
I have the same problem, Please tell me how to fix it if you know how.

thank you very much

Mahawilai


Benz wrote:
> 
> this is my part of jsp:
> ....
> <logic:iterate id="loop" indexId="idx" name="data">
> ....
>   <html:select name="loop" property="sts_1" onchange="checkStsCombo(this,
> 'hasil_1', '<%=idx%>');">
>   ...
>   </html:select>
> ...
> </logic:iterate>
> ...
> 
> I get the html result:
> ...
>   <select name="sts_1" onchange="checkStsCombo(this, 'hasil_1',
> '<%=idx%>');">
> ...
> 
> The '<%=idx%>' text in jsp should be rendered as the value of idx valu
> which is such as '0','1',etc.
> Can anybody tell me why it doesn't works?
> 
> Best Regards,
> 
> Benz
> 

-- 
View this message in context: http://www.nabble.com/html%3Aselect-javascript-onchange-passing-parameter-problem-tp13128698p17332762.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org