4 Replies Latest reply on Feb 12, 2009 1:30 AM by Ymnig

    Script to allow and disallow data entry in a field

    Ymnig

      Title

      Script to allow and disallow data entry in a field

      Post

      Hi

       

      I am looking for a way of making a script that changes themode of a field from "no entry" to "entry allowed" and vice versa.

      I have not found any available script or calculation functions that can provide this mode change.

       

      Please help

       

      Regards

      Ymnig

        • 1. Re: Script to allow and disallow data entry in a field
          Sorbsbuster
            

          Welcome to the forum, Ynmig,

           

          Not a definite answer, but maybe an idea that might lead there.  I have often had a field that is a calculation, like 'Total Price = Unit Price * Qty Ordered', but sometimes I know I will want to over-ride the 'TotalPrice' calculation with a rounded figure, say, or where the idea of 'Unit Price * Qty Ordered' just isn't appropriate.

           

          In that case I have put another field directly on top of the calculated 'Total Price' field - 'Total PriceOverride' - a simple number field.  I make the calculation field of 'TotalPrice' an 'If' statement:

           

          If ('Total PriceOverride' > 0 ; "" ; Unit Price * Qty Ordered )

           

          It creates the impression that the calculation works normally, but I can 'type into the calculation' and change it.

           

          Can you do a similar thing with the two fields here?  You don't say what the condition is, but can I suppose it is something like, 'RecordLocked = 'Yes' '? 

           

          - You can make the calculation of the true (displayed) field value:

          If (RecordLocked = "Yes" ; FieldValue ; FieldValueDataEntry )

           

          - Make the auto-enter calculation for the FieldValueDataEntry:

          If ( RecordLocked = "Yes" ; "" ; FieldValueDataEntry )

           

          This works for me that (ie: it gives the appearance of):

           

          - If you enter something in the field it accepts it, unless:

          - If the record is marked 'Locked' it rejects it and leaves the original data entered.

           

          HTH,

          Alan.

          • 2. Re: Script to allow and disallow data entry in a field
            Ymnig
              

            Hi

             

            Thanks for the tip.

            It's true that calculation fields also have caused me the problems you describe. 

            I will test your proposal.

             

            But the reason for my asking is the definition of a fields functions, where you can tick and untick the box which allows data entry in a field.

            It is this "ticking" I would like to manipulate in a script, from a button.

             

            If you have a solution to this, I really appreciate it.

            Otherwise I will apply your double field solution and perhaps use the nice functions in zippscript for further manipulation, based on field change.

             

            Regards

            Ymnig 

            • 3. Re: Script to allow and disallow data entry in a field
              raybaudi
                

              Ymnig wrote:

               

              But the reason for my asking is the definition of a fields functions, where you can tick and untick the box which allows data entry in a field.

              It is this "ticking" I would like to manipulate in a script, from a button.


              You can't manipulate that "ticking", but you can have a layout with that field unaccessible AND another layout with that field accessible... the script will only change the layout.


              • 4. Re: Script to allow and disallow data entry in a field
                Ymnig
                  

                Thanks

                I have implemented something like that, but I wanted a more straightforward solution.

                I guess this is the best way to come around the problem.

                Regards

                Ymnig