Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
4 replies Latest Post - ‏2012-06-15T16:28:06Z by AnthonyBpm
SystemAdmin
SystemAdmin
7615 Posts
ACCEPTED ANSWER

Pinned topic Custom script problem

‏2012-06-14T12:00:37Z |
Hi All,

I have some vague problem .I am using the following code for achieving custom validation
Placed this below sapn tag inside custom HTML .
*Please Change the Approver
checking this condition in Coach script :
if(<#=tw.local.validateLeaveApprover#>==true){
document.getElementById('changeApprover').style.display='inline';
}

The above code is not working in particular coach and it does not show any script error .

I have used this kind of validation in many places and that is working fine in other coaches .Is any one experienced the same problem and any guess why it is happening ?
Updated on 2012-06-15T16:28:06Z at 2012-06-15T16:28:06Z by AnthonyBpm
  • makvell
    makvell
    269 Posts
    ACCEPTED ANSWER

    Re: Custom script problem

    ‏2012-06-14T16:31:07Z  in response to SystemAdmin
    You do not forget to put your javascript inside the appropriate tag <script>? :)

    Or what is "Coach script"?
  • AnthonyBpm
    AnthonyBpm
    390 Posts
    ACCEPTED ANSWER

    Re: Custom script problem

    ‏2012-06-14T17:42:50Z  in response to SystemAdmin
    Check the value of "tw.local.validateLeaveApprover", if it is not true on the server-side then your code will not run.

    Use firebug, or the built-in developer tools within IE9 or Chrome to check to see how the server-side variable is being sent to the client side. You should see something like:

    
    
    
    if(
    
    true == 
    
    true)
    { ..... 
    }
    


    If you need to reference the server-side variable on the client-side, I would recommend retaining the variable in an object on the client-side, rather than have it be rendered as a literal, e.g.
    
    var validateLeaveApprover = <#=tw.local.validateLeaveApprover#>; 
    
    if(validateLeaveApprover) 
    { ... 
    }
    


    hth
    • SystemAdmin
      SystemAdmin
      7615 Posts
      ACCEPTED ANSWER

      Re: Custom script problem

      ‏2012-06-15T10:07:51Z  in response to AnthonyBpm
      Makvell & AnthonyBpm ,

      I dint forget to put the code inside <script> :)
      if(<#=tw.local.validateLeaveApprover#>==true){
      alert ("in");
      document.getElementById('changeApprover').style.display='inline';
      }
      alert is working properly in inside this if condition.
      The problem is CustomHTML (div tag) is not working.

      Anthony BPM - I modified the code according to your snggesstion.but still div tag is not working .
      • AnthonyBpm
        AnthonyBpm
        390 Posts
        ACCEPTED ANSWER

        Re: Custom script problem

        ‏2012-06-15T16:28:06Z  in response to SystemAdmin
        What does the rendered HTML look like on the client? If you post that, it would help.

        Also, VERIFY the value of the tw.local variable prior to the coach step in your service.