I have the following Javascript primarily used to manipulate a CSS style
and make a portion of a form visible. In the process, the achor invoking
the JavaScript passes parameters from a table Row(resultset) displayed.
In this Row, I have two bean properties declared as Java type Boolean.
The toString() on the link resolves to 'true'/'false' correctly. I have
placed alert tags in the javascript and have determined that the 'if'
statements are working correctly also. The problem is that the two
properties are behaving differently in the view, for reasons I cannot
pin down. document.forms[0].disabled shows the correct status of the
Row, document.forms[0].locked always shows false.
 
I suspected 'locked' may be a reserved word, but have rewritten the bean
and supporting code to rename the property, and this has had no effect.
 
Things that DO WORK: The link is passing the correct values to JS, No JS
error being thrown, as it would if the form property were not found. The
visible, not visible works, also a checkbox instead shows the
appropriate checked/not checked condition, so I can assume a page
refresh is not the issue.
 
Any other debug tips would be appreciated.
 
Javascript:
function
PortalFilterForm_AccountDetails(rowId,rewardSummaryId,pin,inUse,disabled
)
{
    //alert("rowId = " + rowId + "\nrewardSummaryId = " +
rewardSummaryId + "\ninUse = " + inUse + "\ndisabled = " + disabled);
    var detailElement = document.getElementById("accountDetail");
    detailElement.style.visibility = "visible";
    var rid = document.getElementById("rid");
    rid.innerHTML = rowId;
    document.forms[0].rewardSummaryId.value = rewardSummaryId;
    document.forms[0].pin.value = pin;
    if(inUse == true){
        document.forms[0].locked.checked = true;
        //alert("evaluated true");
        }
    else{
        document.forms[0].locked.checked = false;
        //alert("evaluated false");
        }
    if(disabled == true)
        document.forms[0].disabled.checked = true;
    else
        document.forms[0].disabled.checked = false;
    //document.forms[0].locked.value = inUse;
    //document.forms[0].disabled.value = disabled;
    // also tried:
    //document.forms[0].locked.value = inUse + "";
    //document.forms[0].disabled.value = disabled + "";
}
 
 
JSP - Note the commented out code does not work (hidden write=true). The
checkbox does work on both.. (Boolean type on both)
( Struts API says HTML:hidden requires String, but Boolean can be cast,
and remember I have one working property, plus one not working < ? ? >) 
 
<td align="left" width="15%">       <%--<html:hidden property="locked"
write="true"/> --%>
    <html:checkbox property="locked" disabled="true"/> 
</td>
<td align="right" class="form-td-label"  width="15%"><span
class="form-element-label"> Disabled </span></td>
<td align="left">                           <%--<html:hidden
property="disabled" write="true"/>--%>
    <html:checkbox property="disabled" disabled="true"/>
</td>
*
*
<a
href="javascript:PortalFilterForm_AccountDetails(${row_rowNum},${row.rew
ardSummaryId},${row.acctId},${row.inUse},${row.disabled});"
class="fancy">
                    <%=pageContext.getAttribute("row_rowNum")%></a>
 

Reply via email to