ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How To: Create Dynamic SafeCracker Forms?

November 19, 2012 11:51am

Subscribe [2]
  • #1 / Nov 19, 2012 11:51am

    Klauss

    33 posts

    Hi, I’m working on a Real Estate project, and I am curios if there is any way to assemble the following situation :

    When the broker makes a new entry to the main channel, based on his decision , different fields to appear , EXample :

    He choses: If he choses from the list the type of property as being a FLAT, then, for example,  the garden field option to dissapear.

    The main point is that the form to hide/ arange the fields depending on the “decisions” the broker is doing when completing the Form.

    One example is the Pro Form addon for Dd. but the thing is that with that addon I can’t select which channel the form to attach to

    So, any idea, Thank you

  • #2 / Nov 21, 2012 11:29am

    Dan Decker

    7338 posts

    Hi Klauss,

    Indeed, this can be done, but it’s not specific to ExpressionEngine or SafeCracker, per-se.

    You would handle this on the Front-end using JavaScript. As an example, this bit of jQuery will show/hide a set of SafeCracker fields based on the choice made in the status dropdown:

    < script type="text/javascript">
    $('.prez-fields').hide();
    if ($('select:status').val() == 'Presenter')
    {
        $('.prez-fields').show();
    }
    else
    {
        $('.prez-fields').hide();
    }
    </ script>

    The only caveat will be none of the fields that may be hidden could be required in the channel field’s settings.

    Cheers,

  • #3 / Nov 24, 2012 7:45am

    Klauss

    33 posts

    Thank you, but where do i know the CSS clases of the fields generated by the safecracker ?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases