Results 1 to 7 of 7

Thread: Disable field

  1. #1
    User
    Join Date
    01-25-10.
    Location
    France
    Posts
    61

    Default Disable field

    Hello,
    In a efg form , could it be possible to set a field to disabled,
    the user will be able to see the content of the field without having the possibility to modify it
    Thanks for replying
    Sharing and growing

  2. #2
    User
    Join Date
    01-25-10.
    Location
    France
    Posts
    61

    Default Re: Disable field

    Hello,
    Just an up about this post :
    I havent seen some background means to disabled a field in a form.
    Could you help?

    Thank you from South of France
    Sharing and growing

  3. #3
    New user
    Join Date
    07-11-09.
    Location
    Cambridge, UK
    Posts
    11

    Default Re: Disable field

    Yes.. could someone explain (using TL2.8) how exactly to set a text field in an efg form to be either 'disabled' or 'readonly'.
    Follwing other posts e.g. http://www.typolight-community.org/v...=disable#p4594 I have inserted the following into my form DCA in the relevant field section

    Code:
    $GLOBALS['TL_DCA']['tl_formdata']['fields']['mklotid']['eval']['disabled'] = true;
    ..but it seems to make no difference at all. I am obviously missing something! I've tried various combinations of disabled/readonly = disabled/readonly/true with no success.

  4. #4
    New user
    Join Date
    07-11-09.
    Location
    Cambridge, UK
    Posts
    11

    Default Re: Disable field

    OK.. i'm getting closer - it DOES work but for the BE only - so the question is, how do I get this field to be disabled/readonly in the FE?

  5. #5
    New user
    Join Date
    07-11-09.
    Location
    Cambridge, UK
    Posts
    11

    Default Re: Disable field

    Sorry to go on about this, but I would be grateful if someone could comment/put me straight on the this issue.

    I did notice that the first function in the ...\frontend\FormTextField.php module does contain a 'readonly' case statement (re adding attributes). Thus, having set the DCA for an efg form field (manually, as in previous post) to be 'readonly', why does this work in the BE but not in the FE? (or...what have I missunderstood/am doing wrong?!)

  6. #6
    User
    Join Date
    01-25-10.
    Location
    France
    Posts
    61

    Default Re: Disable field

    Hello,
    I found a solution about my problem ...

    in a loadFormField hook, and about the targeted fields (filtered by $strForm and $objWidget)
    I inserted the following instruction :
    $objWidget-> __set('disabled',"1");
    And for me, it works fine for textfield or selectmenu item as I wished

    Cool, is't it ?
    Sharing and growing

  7. #7
    User
    Join Date
    01-25-10.
    Location
    France
    Posts
    61

    Default Re: Disable field

    Hello,
    It's not so good ...
    I am searching some means to manager a form with a readonly and mandatory field ...

    This field is set to mandatory in the form manager of the backend
    It is initialised too with a defauklt value in this form

    In a loadFormField hook about this form
    this fiels is set to a value (with a fonctionnal meaning) with a __set('value',valeur) on the target widget
    it is also set to readonly on the same widget

    All is good : the field is displayed with the good value and it is in readonly mode.

    But:
    after the form is validated , TL tells me , that the field is mandatory, by a error message..!
    I found nothing inside TL except that :
    the error message is set because nothing is entered in the related input object

    Some one can help me ?
    Thanks
    Sharing and growing

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •