Announcement

Collapse
No announcement yet.

hide field based on var when insert a new record.

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

  • hide field based on var when insert a new record.

    Hi there,

    i use the following code oNscriptInit

    /**
    * Hide/show a field
    */

    if ($ev_conf_gesprek == '1') // Display field
    {
    sc_field_display({ronde_naam}, 'on');
    sc_field_display({ronde_datum}, 'on');
    sc_field_display({ronde_start_tijd}, 'on');
    sc_field_display({ronde_eind_tijd}, 'on');
    sc_field_display({ronde_nr}, 'on');
    sc_field_display({ronde_kleur}, 'off');
    }
    else if ($ev_conf_gesprek == '2')
    {
    sc_field_display({ronde_naam}, 'on');
    sc_field_display({ronde_datum}, 'off');
    sc_field_display({ronde_start_tijd}, 'off');
    sc_field_display({ronde_eind_tijd}, 'off');
    sc_field_display({ronde_nr}, 'on');
    sc_field_display({ronde_kleur}, 'off');
    }
    else
    {
    sc_field_display({ronde_naam}, 'on');
    sc_field_display({ronde_datum}, 'off');
    sc_field_display({ronde_start_tijd}, 'off');
    sc_field_display({ronde_eind_tijd}, 'off');
    sc_field_display({ronde_nr}, 'on');
    sc_field_display({ronde_kleur}, 'on');
    }





    works fine, depending on the value it shows or hides fields. When i insert a new record, all the fields are shown but i wan't to hide this fields also, based on the value. SO i put this code in beforeInsert. that didi'nt work..

    any sugestions? Simply hiding the fields isn't an option, because when the value is changed i want the field to be shown.

  • #2
    Try AjaxEvents onChange

    Comment


    • #3
      use
      sc_btn_new
      Available when the "Add New" button is clicked. Can be tested and used inside the ScriptCase events, allowing especific programmation in run time.


      Code:
      if (sc_btn_new)
      						{
      						{My_Date} = date('Y/m/d');
      						}

      also exists with delete, update and insert. Check manual

      Comment


      • #4
        He thanks both, this helps a lot. Funny but when you use form setting multiple fields, the script works fine.

        Comment

        Working...
        X