Can I make fields read-only, or non read-only, in a functioncall

Forums Classic DFFS Can I make fields read-only, or non read-only, in a functioncall

Viewing 2 reply threads
  • Author
    Posts
    • #11069
      Jeff Law
      Participant

      Hi
      On one of my forms, I have several tabs defined, and the initial tab that gets displayed is determined by the status of one of the fields which is checked via a rule. This rule also sets which fields are read only.

      What I would like to be able to do is to be able to override what fields are set to read only if the user selects another tab, or one of the field value changes.

      I was thinking of creating a custom JS function to call, but I am struggling a bit to work out the easiest way of doing this. Especially as I am guessing you already have some function to do this built into DFFS. I found a hint of this browsing through the forums looking for the answer when I found this snippet

      
      
      function formReady(){
       if(getFieldValue(“MultiPhase”)==”Yes”){
       spjs.dffs.unhideFieldsByRule([“Phase”]);
       spjs.dffs.flag_Mandatory([“Phase”]);
       }
       else{
       spjs.dffs.hideFieldsByRule([“Phase”]);
       spjs.dffs.clear_Mandatory([“Phase”]);
       }
       }

      There looks like a range of useful functions comes close to the one I want.

      Is there a list of all the functions in dffs? I must confess to not being a fulltime developer, so might be missing the obvious here.

      Regards
      Jeff

    • #11071
      Alexander Bautz
      Keymaster

      Hi,
      You don’t have to use a custom function. Just create another rule triggering on the selected tab or the field you want to control the other fields with. Use this rule to set the fields as “editable” – this will override the other rule as long as it is triggered after the first one.

      Let me know if you need more details.

      Alexander

    • #11106
      Jeff Law
      Participant

      Thanks Alexander. Finally got the plot and it is now working.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.