Uniface User Forum

 View Only
  • 1.  DSPs and dimming fields.

    PARTNER
    Posted 02-18-2022 07:09
    #uniface-10

    I am trying to dim and resurrect a field in a DSP in response to user actions. 
    I was trying $fieldproperties(field)="html:disabled"  (which I thought is what the help pointed to) without success. 
    I can dim the field with $fieldsyntax(field)="DIM" which successfully sets the disabled attribute. 
    However, neither $fieldsyntax(field)="" nor $fieldsyntaxt(field)="YED,YPR" nor $fieldproperties(field)="!html:disabled" seem to do the trick for allowing entry again. 
    What is the trick to remove the disabled attribute? (preferably from proc code but I suppose I can incorporate a weboperation if necessary. 
    Regards, 
    Iain

    ------------------------------
    Iain Sharp
    Head of Technical Services
    Pci Systems Ltd
    Sheffield GB
    ------------------------------


  • 2.  RE: DSPs and dimming fields.

    ROCKETEER
    Posted 02-18-2022 10:09
    Which triggers are you using ?

    fieldsyntax is an occurrence level property.
    Use Deserialize triggers to apply changes or secure dynamic changes done before in the Serialize triggers

    I have this example:
    In the preSerialize trigger (Pre Save Occurrence in Uniface 9.7)
    if ($dbocc(EDATA) )
    fieldsyntax FLD1.EDATA,"NED"
    else
    fieldsyntax FLD1.EDATA,"YED"
    endif
    and in the postDeserialize (Post Load Occurrence in Uniface 9.7)
    if ($occcrc(EDATA) != "")
    fieldsyntax FLD1.EDATA,"NED"
    else
    fieldsyntax FLD1.EDATA,"YED"
    endif
    Now existing occurrences can't be changed and new occurrences can be changed.


    ------------------------------
    Peter Beugel
    Rocket Internal - All Brands
    Amsterdam NL
    ------------------------------



  • 3.  RE: DSPs and dimming fields.

    PARTNER
    Posted 02-18-2022 11:01
    This is on the onchange trigger of a check box. Tick the checkbox and it fills in a field with a hard coded value and dims it, untick the checkbox and the field is open for manual input. 
    There is only one occurrence. and the "DIM" works fine.

    ------------------------------
    Iain Sharp
    Head of Technical Services
    Pci Systems Ltd
    Sheffield GB
    ------------------------------



  • 4.  RE: DSPs and dimming fields.
    Best Answer

    ROCKETEER
    Posted 02-22-2022 07:17
    Hello Iain

    The script below works fine

    if (checkbox.widgets)
     datepicker = $date +14d
      putitem/id $fieldproperties(DATEPICKER) , "html:disabled" , "true"
    else
    ;  $fieldproperties(DATEPICKER.WIDGETS) = "!html:disabled"
      putitem/id $fieldproperties(DATEPICKER) , "html:disabled" , "false"
    endif​

    Peter Beugel
    Principal Technical Support Engineer
    Rocket Software B.V.

    ------------------------------
    Peter Beugel
    Rocket Internal - All Brands
    Amsterdam NL
    ------------------------------



  • 5.  RE: DSPs and dimming fields.

    PARTNER
    Posted 02-25-2022 11:44
    Hmm, since I was writing generic code in a global proc to dim/hide/display fields, I had a bit of a mistake in that I was doing 
    putitem/id $fieldproperties(v_fieldname) , "html:disabled","false"
    $fieldproperties(v_fieldname)="!style:display"​

    in order to counter previous settings of either 
    $fieldproperties(v_fieldname)="style:display=none"


    or

    putitem/id $fieldproperties(v_fieldname>=), "html:disabled","true"

    Is there a putitem version for the style: setting or do I just have to watch the order I do them in?

    ------------------------------
    Iain Sharp
    Head of Technical Services
    Pci Systems Ltd
    Sheffield GB
    ------------------------------



  • 6.  RE: DSPs and dimming fields.

    ROCKETEER
    Posted 03-01-2022 07:31
    The following below also works:
    if (checkbox.widgets)
      putitem/id $fieldproperties(DATEPICKER) , "style:display" , "none"
    else
      putitem/id $fieldproperties(DATEPICKER) , "style:display" , ""
    endif

    Peter Beugel
    Principal Technical Support Engineer
    Rocket Software B.V.



    ------------------------------
    Peter Beugel
    Rocket Internal - All Brands
    Amsterdam NL
    ------------------------------