This is not an Struts question, but I will give you some hints. The anchor tag does not submit a form to the server (unless you are using the AJAX theme, but that's another story), so you should put those checkboxes inside a form with a submit tag, and add an "onsubmit" event to the form for validation.
hope that helps musachy On 4/12/07, Ezequiel Puig <[EMAIL PROTECTED]> wrote:
Hi, I am trying to use the <s:hidden> tag but i am having some problems. What i want to do is to fill the hidden tag with an array that I create using Javascript. My code: * In the jsp part i have this: <a href="<s:url action="Compare.do" includeParams="get"></s:url>" onclick="return prepareCheckList();" </a> <s:hidden id="compareList" name="compareList" /> *the Javascript part: function prepareCheckList(){ var collectionChecks = document.getElementsByName("checkProduct"); var totalChecked = 0; var list = newArray(); for(var i=0; i<collectionChecks.length; i++) { if (collectionChecks[i].checked){ list[totalChecked] = collectionChecks[i].value; totalChecked ++; } if(totalChecked >5 ){ alert("Only 5 can be selected"); return false; //we don't go to the Compare page. } } document.getElementById("compareList").value = list; return true; //we follow the url. } * In the Action, i have defined: private Collection compareList; public Collection getCompareList() { return compareList; } public void setCompareList(Collection compareList) { this.compareList = compareList; } But i don't manage to get the "compareList" in the Action. I don't know if i am doing something wrong in the JavaScript part or if i am doing something that is not possible. Can anybody help me??
-- "Hey you! Would you help me to carry the stone?" Pink Floyd