Announcement

Collapse
No announcement yet.

Form (Multiple Records): disable a field(Days), based on its value

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

  • Form (Multiple Records): disable a field(Days), based on its value

    Hello everyone,

    I have a form (Multiple Records). There is a calculated field called {Days}. If ({Days} > 4), then field {comment} must be disabled.

    I did it this way, in the onRecordLoad:

    Code:
    if ({Days} > 4)
    	{sc_field_disabled("comment");}
    else
    	{sc_field_disabled("comment=false");}
    Now what happens is this: once the first row {Days} > 4, I get all {comment} fields disabled. If the first row {Days}<= 4, I get all {comment} fields enabled.

    What should I do so that the enabling / disabling goes for only the specific rows that match the criteria?

    Thanks for replying.
    Last edited by michael; 12-03-2014, 03:22 AM.

  • #2
    Originally posted by michael View Post
    What should I do so that the enabling / disabling goes for only the specific rows that match the criteria?
    This does not work ...
    Best regards: - Reinhard -

    I use ScriptCase 8 Enterprise Edition, Version 8.(latest)

    Comment


    • #3
      Option might be to use a grid with a link to a form to edit the record, i.e. in a modal form. It will work within a single-record form.
      Albert Drent
      aducom software netherlands
      scriptcase partner, reseller, support and (turn-key) development
      www.scriptcase.eu / www.scriptcase.nl

      Comment


      • #4
        Originally posted by RHS View Post
        This does not work ...
        But any other solution is OK: But I want data input can be edited only for 4 days. After that no more edit, but at the same time I want to see several records such as in a grid or Multiple Records.

        Comment


        • #5
          Hi,
          have a look at this thread

          http://www.scriptcase.net/forum/show...color-and-lock!

          It's very similar.

          jsb

          Comment


          • #6
            Originally posted by jsbinca View Post
            Hi,
            have a look at this thread

            http://www.scriptcase.net/forum/show...color-and-lock!

            It's very similar.

            jsb
            Hi,

            Have got close to the solution.

            I have inserted following code in the OnLoadRecord:

            sc_ajax_javascript('testjs',array(4));//Just a way to test if can disable partial


            I have created Javascript Method called testjs(index):

            document.F1['id_sc_field_comment_'+index].disabled = true;


            The above works, so that every time I click the <Next> navigation button, I get the fourth row {comment} disabled! For each "page" (of 10 records).

            Now how do I change above code so that only rows, which match my criteria: if ({Days} > 4) { sc_ajax_javascript('testjs',array(??));}

            Is there a way to get the row number each time. I tried hard and, unfortunately, could not at the moment get it.

            Thanks for your final help!!
            Last edited by michael; 12-03-2014, 12:59 PM.

            Comment


            • #7
              Hi, Try this

              sc_field_disabled_record("comment; column2; column3"); <--- For more than one column
              sc_field_disabled_record("comment"); <--- For one column

              Comment


              • #8
                Originally posted by willian_fernando View Post
                Hi, Try this

                sc_field_disabled_record("comment; column2; column3"); <--- For more than one column
                sc_field_disabled_record("comment"); <--- For one column
                The criteria {Days} > 4 not taken care of in your proposal...

                Comment


                • #9
                  Originally posted by willian_fernando View Post
                  Hi, Try this

                  sc_field_disabled_record("comment; column2; column3"); <--- For more than one column
                  sc_field_disabled_record("comment"); <--- For one column
                  Nice one, but where did you find it?
                  No reference in the docu (yet?).

                  @michael
                  onLoadRecord:

                  if({Days} > 4)
                  {
                  sc_field_disabled_record("comment");
                  }



                  jsb

                  Comment


                  • #10
                    Most likely on the brazilian forum: http://www.scriptcase.com.br/forum/i...p?topic=7896.0
                    Albert Drent
                    aducom software netherlands
                    scriptcase partner, reseller, support and (turn-key) development
                    www.scriptcase.eu / www.scriptcase.nl

                    Comment


                    • #11
                      That rises the question: How many sc-macros are out there I/we have no idea of just because they aren't mentioned anywhere?

                      jsb

                      Comment


                      • #12
                        I would call it undocumented features. Realy don't know. Not uncommon though. Windows and IOS are full of them...
                        Albert Drent
                        aducom software netherlands
                        scriptcase partner, reseller, support and (turn-key) development
                        www.scriptcase.eu / www.scriptcase.nl

                        Comment


                        • #13
                          Originally posted by michael View Post
                          The criteria {Days} > 4 not taken care of in your proposal...
                          Yes Sorry
                          Forgot to complete. but I'm glad it worked

                          This code you can see in the security module in the application that enables or disables the applications to users or groups, in my project = app_form_sec_usuarios_apps

                          Comment

                          Working...
                          X