Announcement

Collapse
No announcement yet.

Blocks are not hideing using - sc_block_display

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

  • Blocks are not hideing using - sc_block_display

    Hello everyone,

    I'm using this version of scriptcase:
    Version 8.00.0030
    Types pe_mysql_bronze
    ##############################

    i made this little script:
    //--------------------------------------------------------------------
    if ({label} == '1') // Display block
    {
    sc_block_display(operation_n_sdt, 'on');
    sc_block_display(operation_sdt, 'off');
    }
    else // Hide block
    {
    sc_block_display(operation_n_sdt, 'off');
    sc_block_display(operation_sdt, 'on');
    }
    //--------------------------------------------------------------------

    I defined the php method - labelscript, and called it in:
    on aplication init;
    on navigate;
    on script init;
    on load;
    on refresh;
    on after insert;
    on after update;

    and i made also a ajax event for the field "label" - on change.

    The bloks remains unhidenn.

    Any ideea what i can do about this?

    Thank you,
    Dan
    Last edited by dan.dinu; 02-13-2015, 01:47 AM. Reason: the thread was solved
    Thanks for your time & have a nice day,
    Dan

    //覧覧覧覧覧覧覧
    Scriptcase Version 8.00.0030
    Types pe_mysql_bronze

  • #2
    Nothing obviously wrong I can see. But first, a couple of "just to be sure" questions....

    - I presume this is a form (as opposed to a grid)?
    - the names operation_n_sdt and operation_sdt are defined as named blocks?

    Second - 2 possibilities:

    - What is the data type of {label}? - if it's integer / numeric then don't wrap the 1 in quotes.
    Code:
    if ({label} == 1)
    - The field {label}, is that it's actual name? Not sure if "label" might be a reserved word so maybe try and rename the field to {label1} and change the references to match?
    Last edited by adz1111; 02-11-2015, 08:50 AM.

    Comment


    • #3
      Partial solved

      ok, i made the changes:
      **************************
      - file_label is/was integer;
      - file_label changed from label;
      - the actions takes in a form.
      **************************
      cod
      //---------------------
      if ({file_label} == 1)
      {
      sc_block_display(operation_std, 'off');
      sc_block_display(operation_n_std, 'on');
      }
      else if ({file_label} == 0)
      {
      sc_block_display(operation_std, 'on');
      sc_block_display(operation_n_std, 'off');
      }

      else // Hide block
      {
      sc_block_display(operation_n_std, 'off');
      sc_block_display(operation_std, 'off');
      }
      //------------------------------
      the last else i don't think is necessary ..but i put it anyway.

      Now it is working just this area:
      //---------------------------
      else if ({file_label} == 0)
      {
      sc_block_display(operation_std, 'on');
      sc_block_display(operation_n_std, 'off');
      }
      //--------------------------------

      in this part of cod:
      //--------------------------------
      if ({file_label} == 1)
      {
      sc_block_display(operation_std, 'off');
      sc_block_display(operation_n_std, 'on');
      }
      //---------------------------------------

      I have active both bloks...

      any ideea what to do?

      thank you
      Thanks for your time & have a nice day,
      Dan

      //覧覧覧覧覧覧覧
      Scriptcase Version 8.00.0030
      Types pe_mysql_bronze

      Comment


      • #4
        Maybe the label values are not being set quite as you think.

        What happens if you change:

        Code:
        else if ({file_label} == 0)
        To

        Code:
        else if ({file_label} != 1)
        If that works then {file_label} is never zero as you thought, i.e. maybe it's NULL? In which case leave as is using NOT (!), or confirm the values to test against, and adjust accordingly.

        Comment


        • #5
          As it looks you have only one 'true' value. So no need to mess around, keep it simple.

          Bring both blocks to defined state at the beginning of your code.

          sc_block_display(operation_std, 'off');
          sc_block_display(operation_n_std, 'off');

          if ({file_label} == 1)
          {
          sc_block_display(operation_n_std, 'on');
          }
          else
          {
          sc_block_display(operation_std, 'on');
          }

          Should work like a charm.

          jsb

          Comment


          • #6
            Originally posted by jsbinca View Post
            As it looks you have only one 'true' value. So no need to mess around, keep it simple.

            Bring both blocks to defined state at the beginning of your code.

            sc_block_display(operation_std, 'off');
            sc_block_display(operation_n_std, 'off');

            if ({file_label} == 1)
            {
            sc_block_display(operation_n_std, 'on');
            }
            else
            {
            sc_block_display(operation_std, 'on');
            }

            Should work like a charm.

            jsb
            Thank you, it worked
            Thanks for your time & have a nice day,
            Dan

            //覧覧覧覧覧覧覧
            Scriptcase Version 8.00.0030
            Types pe_mysql_bronze

            Comment

            Working...
            X