Duane, 

As far as I understand, "disabled" is a property of the form which should 
be denoted as

document.forms[0].disabled 

and not just by disabled as you have done in

if(disabled ==true )

change it to:

if( document.forms[0].disabled == true )

and it should work. 

This is the reason the if(.......) is always evaluating to "false" (i.e 
the 'else' case).



Amitava Basak
ASE
Tata Consultancy Services Limited
Mailto: [EMAIL PROTECTED]
Website: http://www.tcs.com



"Duane Rosengartner" <[EMAIL PROTECTED]> 
08/06/2005 12:13 AM
Please respond to
"Struts Users Mailing List" <user@struts.apache.org>


To
<struts-user@jakarta.apache.org>
cc

Subject
Javascript + Struts <html:hidden write='true'> tag problem






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>
 

ForwardSourceID:NT00007576 


Notice: The information contained in this e-mail message and/or attachments to 
it may contain confidential or privileged information.   If you are not the 
intended recipient, any dissemination, use, review, distribution, printing or 
copying of the information contained in this e-mail message and/or attachments 
to it are strictly prohibited.   If you have received this communication in 
error, please notify us by reply e-mail or telephone and immediately and 
permanently delete the message and any attachments.  Thank you

Reply via email to