File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Struts1 - multibox uncheck action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts1 - multibox uncheck action" Watch "Struts1 - multibox uncheck action" New topic
Author

Struts1 - multibox uncheck action

Chandran Madesh
Greenhorn

Joined: Nov 30, 2007
Posts: 4
Hi,

In one of my jsp page, i am iterating some values with Multibox. As part of requirement, i need to populate the selected multibox value in another text box. Also the value needs to be removed from the text box when the corresponding multibox is unchecked.

I was able to make the first part(populate the value when a multibox is selected) working with the help of onclick JS function. But i couldn't make the second part work properly. I tried using hidden variable, JS array, but i could not get the value when a multibox is unchecked.

I want to know is there a way to get the value when a multi box unchecked.

Any suggestions / input would be appreciated.

Thanks in Advance,
Chandran
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

Is it resolved? If not, just a thought, to check or uncheck the multibox there is "onclick" action. why is it not possible to refresh the destination/selected list on every onclick action.


Have Fun with Java
little,little.. little by little makes a lot..
Chandran Madesh
Greenhorn

Joined: Nov 30, 2007
Posts: 4
Hi Shankar,

Thanks for your post.

Already i tried this onclick action. As far as i know, the one option to get the selected value is iterate all the multibox and check is it selected, if <Multibox>.checked==true read the value. The below is the js function i used to read the Multibox value. This is working fine when the mutibox is selected. But when the Multi box is delected i couldn't get the value as the current deselected box fail for the .checked==true condition.


Do you see any other option.

>
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

Which version of Struts is it 1.?

Also could you just post how you are calling js method in JSP, it would be helpful..
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

Try selected instead on checked.. Anyways I shall try in my local and let you know... I use Str.1.2
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

Ok, I just tried it in S1.2.. this should work, try it once

In JSP something like this



in js, I just got stuck/stumped with the options though. Here the tutorial is good (best one for you and you need not search anymore) and i just used it...


 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Struts1 - multibox uncheck action