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

Need help for customer action for form submissions #592

Open
flylzj opened this issue Oct 1, 2023 · 1 comment
Open

Need help for customer action for form submissions #592

flylzj opened this issue Oct 1, 2023 · 1 comment
Labels
Type: Question Further information is requested

Comments

@flylzj
Copy link

flylzj commented Oct 1, 2023

Hey guys, I am writeing a feature and meting a problem. here is the situation below, user fill the userinfo form and admin can Review the form and jump to the add acount view. I don't know how and where to add the jump button. I have tried the code below, it only show the text not the html.

class MySubmissions(AbstractFormSubmission):

    def get_data(self):
        """
        Returns dict with form data.

        You can override this method to add additional data.
        """
        form_data = super(MySubmissions, self).get_data()
        form_data["add_account_href"] = "<button><a href='/admin/users/add?info=xxx'</a></button>"
        return form_data


class JoinUsFormPage(CoderedFormPage):
    class Meta:
        verbose_name = "成为会员表单页"

    template = "coderedcms/pages/form_page.html"

    def get_submission_class(self):
        return MySubmissions

    def get_data_fields(self):
        """
        Returns a list of tuples with (field_name, field_label).
        """

        data_fields = super().get_data_fields() + [("add_account_href", "添加账户")]
        return data_fields

Please help me, thank you

@flylzj flylzj added the Type: Question Further information is requested label Oct 1, 2023
@tsmaddox15
Copy link

@flylzj could the crx html block work for you? https://docs.coderedcorp.com/wagtail-crx/features/blocks/contentblocks/html.html

If not can you share what the template looks like? Instead of putting the html inside the form_data, might be better to store the href and do something like this in the template.
<button><a href="{{ add_account_url }}"></a></button> where add_account_ url is the /admin/users/add?info=xxx you are storing in form_data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants