• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Html:MultiBox issue

 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am struck up with this problem for more than five hours and i could not go ahead with my coding. Can any one of you look into and could give an suggestion it could be a great help to me.

I am using Html:Multibox and i use this inside the nested iterate tag to dynamically generate the check box.
<nested:iterate property="alRLDoc">
<html:multibox property="arrSelectedId">
<nested:write property="seq_Id" />
</html:multibox>
<!-- display some data -->
</nested:iterate>

The user can check single or more than one check box and click on save button. On click of the save button i want to check if he has selected a value else throw an alert message.
I wrote a js like this but it doesnt work.
if(document.ReportForm.arrSelectedId != null){
document.ReportForm.strTabInd.value = 'N';
document.ReportForm.submit();
}else{
alert("Please Select an Document");
}
And in some scenarios i need to check how many values are selected. If its more than one i need to throw an alert. I am also not able to do this because if its a single java script does not consider it as a string array.
Please help in solving this problem.

Regards,
Arul.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First of all, when you want to use javaScript to tell whether a check box is checked or not, you query its "checked" property rather than checking for null.

Second, since your code is creating a number of checkboxes that all have the same name, you need to use an array to contain them all, and check each one individually. Here is some suggested code to point you in the right direction:


[ December 21, 2005: Message edited by: Merrill Higginson ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic