Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Zain 4 posts 74 karma points
    Nov 15, 2024 @ 08:30
    Zain
    0

    Umbraco show/hide conditions for submit button doesn't work

    The latest Umbraco versions have the functionality to show or hide submit buttons using conditions. But for my case it doesn't work. For other field I have fieldsets and while iterating over fieldsets I do this

    var hideFieldWhenRendering = f.HasCondition && f.ConditionActionType == FieldConditionActionType.Show;
    

    and add class on the div like this @{ if (hideFieldWhenRendering) { } }

    But submit buttons is not a part of fieldset and I don't find a way to check attribute HasCondition for it. My html for submit looks like this

    <div class="umbraco-forms-navigation row-fluid">
    
    <div class="col-md-12">
        @if (Model.IsMultiPage)
        {
            if (!Model.IsFirstPage)
            {
                <input class="btn prev cancel"
                       type="submit"
                       value="@Model.PreviousCaption"
                       name="__prev"
                       formnovalidate
                       data-form-navigate="prev"
                       data-umb="prev-forms-form" />
            }
    
            if (!Model.IsLastPage)
            {
                <input type="submit"
                       class="btn next"
                       value="@Model.NextCaption"
                       name="__next"
                       data-form-navigate="next"
                       data-umb="next-forms-form" />
            }
    
            if (Model.IsLastPage)
            {
                <input type="submit"
                       class="btn primary"
                       value="@Model.SubmitCaption"
                       name="__next"
                       data-form-navigate="next"
                       data-umb="submit-forms-form" />
            }
        }
        else
        {
            <div class='input -right submit-button'>
                <input type='submit' name="submitbtn" class='button -cta' id='submit' value='@Model.SubmitCaption'>
            </div>
        }
    </div>
    

Please Sign in or register to post replies

Write your reply to:

Draft