Deeps Mistry wrote:Hi,
I have 2 rows in my table. One is multibox of products and other is Quantity. I have kept the quantity text box disabled by default.
What i want is : when i click on the multibox the corresponding quantity text box must get enabled.
I have tried : document.forms[0].quantity.disabled=false; but its not working.
Here is my code:
<logic:iterate id="Challan" name="Challan">
<tr>
<td >
<html:multibox name="Challan" property="checkedProducts" onclick="enableThis();">
<bean:write name = "Challan" property="products" />
</html:multibox> <bean:write name = "Challan" property="products" />
</td>
<td >
<html:text name = "Challan" property="quantity" size="10" disabled="true"/>
</td>
</tr>
</logic:iterate>
function:
function enableThis()
{
alert("");
document.forms[0].quantity.disabled=false;
}
Please help.
Shahid.
Shahid Shaikh wrote:
Deeps Mistry wrote:Hi,
Hi Deeps,
You can try it out by assigning ID to u'r field and then trying this code
Hey Shahid,
'id' attribute is not valid for <html:text> . Can you please any other way?
Thanks for your help.
Shahid Shaikh wrote:You can try it out by assigning ID to u'r field and then trying this code
Deeps Mistry wrote:Hi,
I have 2 rows in my table. One is multibox of products and other is Quantity. I have kept the quantity text box disabled by default.
What i want is : when i click on the multibox the corresponding quantity text box must get enabled.
I have tried : document.forms[0].quantity.disabled=false; but its not working.
Here is my code:
<logic:iterate id="Challan" name="Challan">
<tr>
<td >
<html:multibox name="Challan" property="checkedProducts" onclick="enableThis();">
<bean:write name = "Challan" property="products" />
</html:multibox> <bean:write name = "Challan" property="products" />
</td>
<td >
<html:text name = "Challan" property="quantity" size="10" disabled="true"/>
</td>
</tr>
</logic:iterate>
function:
function enableThis()
{
alert("");
document.forms[0].quantity.disabled=false;
}
Please help.
Deeps Mistry wrote:
Shahid Shaikh wrote:
Deeps Mistry wrote:Hi,
Hi Deeps,
You can try it out by assigning ID to u'r field and then trying this code
Hey Shahid,
'id' attribute is not valid for <html:text> . Can you please any other way?
Thanks for your help.
Hey Deeps ,
You can try out "styleId" attribute it is Identifier to be assigned to this HTML element (renders an "id" attribute). Please try this and see if it is helpfull
Cheers![]()
![]()
Shahid.
Shahid Shaikh wrote:
Deeps Mistry wrote:
Shahid Shaikh wrote:
Deeps Mistry wrote:Hi,
Hi Deeps,
You can try it out by assigning ID to u'r field and then trying this code
Hey Shahid,
'id' attribute is not valid for <html:text> . Can you please any other way?
Thanks for your help.
Hey Deeps ,
You can try out "styleId" attribute it is Identifier to be assigned to this HTML element (renders an "id" attribute). Please try this and see if it is helpfull
Cheers![]()
![]()
Hey ,
Style id is working javascript:emoticon('');. But the problem is that only the first row is getting enabled.
As i explained earlier, i have two columns and the no of rows depends on the data. So i am using < logic:iterate > to iterate over the data. In this case what should i do?
Also i am using multibox.
Do you have any idea on this?
Thanks for your timely help.
Deeps Mistry wrote:Hey ,
Style id is working javascript:emoticon('');. But the problem is that only the first row is getting enabled.
As i explained earlier, i have two columns and the no of rows depends on the data. So i am using < logic:iterate > to iterate over the data. In this case what should i do?
Also i am using multibox.
Do you have any idea on this?
Thanks for your timely help.
Eric Pascarello wrote:As I mentioned on March 3rd, show us the generated source.
Eric
Eric Pascarello wrote:Also USE CODE TAGS please. Makes it easier to read.
Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
Sam Mercs wrote:Deeps,
You problem is a bit complicated. Let me see if I get the explanation right.
1. You generate a number of rows and you need to enable a textbox in a row depending on the selected box clicked for that row!
2. One thing that you have wrong in you 'jsp' code is that you are assigning the same styleId to all the quantity boxes. This means that all the quantity boxes in your page have the same Id which is incorrect! So the first thing that you will have to correct is generate a unique styleId for each textbox.
3. In your Java script function instead of document.getElementById('id_1').disabled=false; you would write something like this,
Of course the most difficult part out here is getting the Row Id,
4. You call the enable function with a parameter this.value --> onclick="enableThis(this.value). While this could help you with the alert to display which value was selected in the multibox, it gives no information regarding the row.
What you need here instead is something like
Combine this with step 3 and you got what you looking for.
5. There is an easier way to do all this, but you'll need to be using Jquery! (I sometimes do wonder how JS could be written without it!!) -- Then you could use DOM manipulation to get this to work in a much easier manner. maybe not the most correct - but definitely a lot easier.
Hope this answer helped. its complicated - but then so is what you are trying to achieve.
Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
Sam Mercs wrote:Yep there should be a simple solution - but it would help if you post what you are trying out.
If you are using a rototiller, you are doing it wrong. Even on this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|