Announcement

Collapse
No announcement yet.

Dynamically Setting Form Styles

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dynamically Setting Form Styles

    The macro "sc_field_style" gives us the ability to change grid styles during events, however it doesn't work for forms.

    How do I change field styles on a form?

    It doesn't really make much sense that this only works for grids, but not forms.

    -Thanks for any advice.

  • #2
    Yes you are right. But it's fairly simple to do that using javascript. If you google this forum then you will find much samples. One sample can be found here:

    http://scriptcase.aducom.com/cms/e10....php?0.cat.6.7
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      I've actually found this example before, but it doesn't seem to do anything. I created a php method called coloration() which contains the following code:

      Code:
      $field = 'OrderStatus';
      $color = 'red';
      print "In color.";
      if({OrderStatus} > 5)
      {
      	$color = 'green';
      }
      sc_ajax_javascript('set_color',array($field,$color));
      I put the coloration() method in my OnLoad event like the forum suggested. Then I created a javascript method with 2 input paramaters and the following code:

      Code:
      document.F1[field].style.backgroundColor = color;

      Comment


      • #4
        Alright, so I found out why it wasn't working. Apparently the field name must be lowercase, despite the field name having capitalized letters in the development environment. Once I changed the field variable from OrderStatus to orderstatus, it worked!

        Comment


        • #5
          It's not working in situation when i want change color of field in multiple rows detail form in master/detail form

          Comment

          Working...
          X