This works fine in chrome and firefox but does not in IE6. i am yet to try it out in IE 7. As you can see, i have an input field and when user enters a value and clicks on Save, Jquery $("span.saveLink").click (function() gets invoked which populates the SaveUserForm(pls note my input field is outside and its not enclosed in a form). The issue is, form gets submitted but except isNew set to 0 or 1, all other fields in Struts action show ""(empty string) when i do this in IE6 where as in Chrome and Firefox, form values get populated correctly in Struts. Action. I tried Firebug and did not complain of any javascript errors. What am i doing wrong? Please respond quickly as testing is blocked.
I tried to replace $("form#saveUserForm input#userGuid").val(id); $("form#saveUserForm input#amount").val(value); $("form#saveUserForm input#totalAvailableStorage").val (totalAvailableStorage); with document.saveUserForm.userGuid=id; document.saveUserForm.amount=id; document.saveUserForm. totalAvailableStorage =id; but IE6 complains that those properties are undefined. <script src="scripts/jquery-1.3.2.min.js"></script> <script language ="javascript"> $(document).ready(function() { // Add striping for data tables $('table.cbobDataTable tbody tr:nth-child(odd)').addClass('odd'); $('table.cbobDataTable tbody tr:nth-child(even)').addClass('even'); $('div.edit').hide(); $('div.view').show(); var numUserListRows = $('table#userList tr').length - 1; var totalAvailableStorage = "<fmt:formatNumber value="$ {requestScope.profileInfo.cbobTotalPurchased - requestScope.profileInfo.cbobTotalAllocated}" maxFractionDigits="0" / >"; // Save link functionality $("span.saveLink").click(function() { // Get the user id and submit the "save" form var name = $(this).parents('tr').eq(0).children().eq(0).html(); var id = $(this).parents('tr').eq(0).get(0).id; var value = $(this).parents('tr').eq(0).children().find('div.edit input:first').val(); //alert('value='+value); var isNew = $(this).parents('tr').eq(0).hasClass("newUser"); // Set the guid, storage amount and isNew indicator into the // saveUserForm and submit the form. $("form#saveUserForm input#userGuid").val(id); $("form#saveUserForm input#amount").val(value); $("form#saveUserForm input#totalAvailableStorage").val (totalAvailableStorage); if (isNew) { $("form#saveUserForm input#isNew").val("1"); } else { $("form#saveUserForm input#isNew").val("0"); } $("form#saveUserForm").submit(); }); }); </script> <c:forEach var="row" items="${requestScope.profileInfo.users}" varStatus="counter"> <tr id="${row.guid}"> <td>${row.lastName}, ${row.firstName}</td> <td> <div class="view"> <fmt:formatNumber value="${row.cbobTotalAllocated}" maxFractionDigits="0" /> <bean:message key="page.ob.summary.gigabyte" /> </div> <div class="edit"> <input name="allocated_amount" value="<fmt:formatNumber value='$ {row.cbobTotalAllocated}' maxFractionDigits='0' />" size="1" /> </div> </td> <td> <fmt:formatNumber value="${row.cbobTotalAllocated - row.cbobTotalUsed}" maxFractionDigits="0" /> <bean:message key="page.ob.summary.gigabyte" /> </td> <td> <fmt:formatNumber value="${row.cbobTotalUsed}" maxFractionDigits="0" /> <bean:message key="page.ob.summary.gigabyte" /> </td> <td> <div class="view"> <span class="editLink"> <bean:message key="page.ob.summary.list.edit" /> </span> </div> <div class="edit"> <span class="saveLink"> <bean:message key="page.ob.summary.list.save" /> </span> </div> </td> <td> <div class="view"> <span class="removeLink"> <bean:message key="page.ob.summary.list.remove" /> </span> </div> <div class="edit"> <span class="cancelLink"> <bean:message key="page.ob.summary.list.cancel" /> </span> </div> </td> </tr> </c:forEach> </tbody> </table> </c:if> </div> <form id="removeUserForm" action="onlinebackup/removeUserConfirm.ms" method="Post"> <input id="userGuid" type="hidden" value="" name="userGuid" /> <input id="userName" type="hidden" value="" name="userName" /> <input id="amount" type="hidden" value="0" name="amount" /> <input id="totalAvailableStorage" type="hidden" value="" name="totalAvailableStorage" /> </form> <form id="saveUserForm" action="onlinebackup/saveUser.ms" method="Post"> <input id="userGuid" type="hidden" value="" name="userGuid" /> <input id="amount" type="hidden" value="" name="amount" /> <input id="totalAvailableStorage" type="hidden" value="" name="totalAvailableStorage" /> <input id="isNew" type="hidden" value="" name="isNew" /> </form>