Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Note on the interaction of conditional-formfields, multipage-form and ajax-form #89

Open
zonky2 opened this issue Mar 25, 2024 · 4 comments

Comments

@zonky2
Copy link
Contributor

zonky2 commented Mar 25, 2024

To ensure that the conditions for previous steps work with MP_Forms, a data attribute is filled with values in the form tag.

When used with ajax-form, the form tag is not updated and therefore no current values can be read from conditional-formfields.

As a workaround, the template ajaxform_inline.html5 can be customised:

<form action="<?php echo $this->action; ?>"<?php if ($this->formId): ?>id="<?php echo $this->formId; ?>"<?php endif; ?>
      method="<?php echo $this->method; ?>"
      enctype="<?php echo $this->enctype; ?>"<?php echo $this->attributes; ?><?php echo $this->novalidate; ?>>
    <div class="formbody">
        <?php if ($this->method != 'get'): ?>
            <input type="hidden" name="FORM_SUBMIT" value="<?php echo $this->formSubmit; ?>">
            <input type="hidden" name="REQUEST_TOKEN" value="{{request_token}}">
            <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $this->maxFileSize; ?>">
        <?php endif; ?>
        <?php echo $this->hidden; ?>
        <?php echo $this->fields; ?>
    </div>
</form>

The behaviour with Contao 5 still needs to be checked.

@zoglo
Copy link

zoglo commented Mar 26, 2024

Wouldn't work with the insert-tag {{request_token}} as it has been removed in C5

@zonky2
Copy link
Contributor Author

zonky2 commented Mar 26, 2024

@zoglo
Copy link

zoglo commented Mar 26, 2024

Remember that ajaxform won't be used in Contao 5 anymore since it's part of the Contao Core in 5.1, thus you'd be able to use the template from the contao core 😄.

Meaning you wouldn't need to bother about that.

@zonky2
Copy link
Contributor Author

zonky2 commented Mar 26, 2024

@zoglo

The behaviour with Contao 5 still needs to be checked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants