Dynamically Show/hide a Control

July 30, 2007

The browser script Control method ‘SetProperty’ is fairly limited: it only works at all with CheckBox, ComboBox, TextBox and TextAreas, and even with these controls I’ve found behaviour to be flaky. In my experience it’s more reliable to grab a handle to the control and access the DOM properties directly.

For instance, to conditionally show or hide a control using browser script, the code looks like this:

var ctrl = thisApplet.FindActiveXControl("My Control");

if( ctrl != null )

{

  if( myFlag )

    ctrl.style.visibility="visible";// show control

  else

     ctrl.style.visibility="hidden";// hide control

}

This approach can also be used to set other display properties – like the font and colors – but you have to be a bit more careful with interactive properties: the standard HTML property disabled does not work the same as Siebel’s Enabled control property, for instance.

The best reference I’ve found to the complete set of DOM properties is on MSDN, with the advantage that everything here should be available to Siebel’s IE-only environment.

Entry Filed under: Scripting, Siebel. .

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Top Posts

Categories

Blogroll

Archives

Feeds

Recent Comments

kishore on Searching Calculated Fields an…
Darrell Jarrett on Discussion Forums for Sie…
stuandgravy on Discussion Forums for Sie…
mary on Discussion Forums for Sie…
stuandgravy on Searching Calculated Fields an…