Results 1 to 4 of 4

Thread: Type of CE inside onload_callback function?

  1. #1

    Default Type of CE inside onload_callback function?

    Contao < 2.11

    Is there a way to find out which content element(CE) (['TL_CTE']) is selected in (Backend)BE, inside onload_callback function?

    Basically I want to change the DCA dynamically depending on the type of CE chosen in BE. I have custom module (which uses tl_content) in which, I use the field 'text' from default CE. I wanted that text field in my custom CE not as mandatory. do anyone have suggestion, please let me know.
    OM MANI PEME HUNG! how many has to die for freedom and dignity. Save this world

  2. #2
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Type of CE inside onload_callback function?

    Another method then using the id to query the database?

  3. #3

    Default Re: Type of CE inside onload_callback function?

    Thank you for the tip.
    I did as you have suggested. Which worked too. But the problem remains because I am using the default text field from CE. The text field get submitted automatically when ever you change the CE type from text to any other, this produce error when you are using the same text field, as it is defined mandatory by default. After force saving the CE, mandatory mark goes away, but it creates confusion!
    The solution in my case is to change the eval mandatory of text field to false in all case!! or I may define a new text field in DB.
    OM MANI PEME HUNG! how many has to die for freedom and dignity. Save this world

  4. #4
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Type of CE inside onload_callback function?

    The solution you used was my first idea, but since you specifically asked for a solution where you switch this off ONLY for your type I opted for querying.

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
  •