Hi Janet,

Let me suggest an idea.

tbUserId_onBeforeHtmlOutput(.. event) {
  if (update) {
    CSpDisplayField df = (CSpDisplayField)event.getSource();
    String htmlText = df.getHtmlText();

    // Convert the generated html tag from "<INPUT type=TEXT..." to
"<INPUT type=HIDDEN..." so that the field stays as part of the Form but
hidden, and also attach the static text part of it.
    
df.setHtmlText(CSpUtil.replaceSubstring(htmlText,"=TEXT","=HIDDEN")+df.getValue().stringValue());
  }
}

Your Javascript should be happy and so should you.

Regards,

Aby

--- Janet Traub <[EMAIL PROTECTED]> wrote:
> I have a page that runs in dual mode: INSERT and
> UPDATE. One column on this freeform page is a
> TextBox.
> When the page runs in UPDATE mode I'd like to hide
> the
> TB and replace it with R/O StaticText. (BTW, the
> reason I'm hiding it is this col is the PK for the
> table so I want to prevent users from modifying it.)
> 
> The only problem is, I have a javascript validation
> function on this page that references the TextBox
> (see
> snippet below). So I'm wondering what's the best way
> to code this behavior so the Javascript snippet
> below
> won't choke when the TextBox goes into hiding during
> UPDATE mode.
> 
> Very basic Javascript snippet:
> if (document.pgXXDetail.tbUserID.value==""
> {
>   if(errors.length==0){
>   document.pgXXDetail.tbUserID.focus();
>    }
>    errors += "UserID is required.\n";
> }
> 
> THX,
> Janet
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at
> http://mail.yahoo.com
> 
>
_________________________________________________________________________
> 
> For help in using, subscribing, and unsubscribing to
> the discussion
> forums, please go to:
> http://www.netdynamics.com/support/visitdevfor.html
> 
> For dire need help, email: [EMAIL PROTECTED]
> 

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

_________________________________________________________________________

For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html

For dire need help, email: [EMAIL PROTECTED]

Reply via email to