Forums

Covering OroCommerce, OroCRM, OroPlatform topics, including community updates and company announcements.

This topic contains 6 replies, has 2 voices, and was last updated by adriwan_kenoby adriwan_kenoby 7 months ago.

  • Creator
    Topic
  • #34512
    adriwan_kenoby
    adriwan_kenoby
    Participant

    Hi OroTeam,

    I would like to implement a dynamic form field. I follow the symfony instruction here but it not working on oro context.

    In need of some advice please.

    Here is my code :

Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
    Replies
  • #34513
    adriwan_kenoby
    adriwan_kenoby
    Participant

    I have change the logic of my HostType:

    and in my view

    My problem is that the value of submited data in ajax is always set to 1 even if I uncheck the box. Next I don’t know how to append the result form on the right place.

    Thanks for your help.

    #34514
    adriwan_kenoby
    adriwan_kenoby
    Participant

    Again another version, I am so close but I don’t know how to handle result of ajax, it’s seems like the response always contains sinabs_hosting_sqlserver_type and so on it is never removed, always appended.

    and add $sqlserverCreated as property of the entity and a methos isSqlserverCreated to access it.

    #34515
    adriwan_kenoby
    adriwan_kenoby
    Participant

    When i use,

    the form is shown when i check the box but it will not disapear when I uncheck the box.
    Then I realize their is a csrf protection, so I have to overwrite de __token.
    How can I achieve this ?
    Maybe for that the owner field is not rendered.

    #34516
    adriwan_kenoby
    adriwan_kenoby
    Participant

    Maybe their is another approach than this ugly javascrpit. I think it may be better to create a custom widget button to render my form field instead of a checkbox. Could you provide example how to do please ?

    #34517

    vitaliyberdylo
    Moderator

    Hello, Adriwan.
    If your goal is to change some form fields depends on sqlserver checkbox,
    you can use the same approach as in DiscountOptionsType in PromotionBundle of OroCommerce

    https://github.com/oroinc/orocommerce/blob/1.6.0/src/Oro/Bundle/PromotionBundle/Form/Type/DiscountOptionsType.php

    https://github.com/oroinc/orocommerce/blob/1.6.0/src/Oro/Bundle/PromotionBundle/Resources/public/js/app/views/discount-options-view.js

    You can check how it works on UI on OroCommerce demo site
    https://demo.orocommerce.com/admin/promotion/create Discount Options section

    #34518
    adriwan_kenoby
    adriwan_kenoby
    Participant

    Thanks !

Viewing 6 replies - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

You will be redirected to [title]. Would you like to continue?

Yes No
ssossossossossosso