Copied to clipboard

Flag this post as spam?

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


  • Clickfarm 77 posts 161 karma points
    Jan 30, 2015 @ 17:31
    Clickfarm
    0

    Umbraco 7.2 Forms plugin - how to hide label?

    I checked in the Forms.cshtml partial view around line 66 there appears to be a condition that will hide the form input label. How do I set this? Is it a "condition" that i have to configure in the admin? how do i configure it? there's no documentation for this that i can find.

    thanks.

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jan 30, 2015 @ 22:46
    Dennis Aaen
    0

    Hi Matt,

    You can hide the fields labels on two different ways. The first is to remove this line from the forms.cshtml. You will find the file in /Views/Partials/Forms.

    @Html.Raw(f.Caption) 

    You will find it in line number 77. If you want to choose which labels that should be hidden, you could simply add a class to the label, e.g hide, and the hide it with CSS. like.

     <label for="@f.Id" class="fieldLabel hideLabel">
        @Html.Raw(f.Caption) @if (f.ShowIndicator){
            <span class="contourIndicator">@Model.Indicator</span>
        }
    </label>   

    And then in your css

    .hideLabel{
        display: none;
    }

    If you mean how you can hide the validation labels, then you can do in the UI for Forms, just click the action button right corner and then validation, in there you will see a checkbox called Hide field validation labels.http://our.umbraco.org/documentation/Products/UmbracoForms/Editor/Creating-a-form/Form-Settings/

    Hope this helps,

    /Dennis

  • Clickfarm 77 posts 161 karma points
    Jan 30, 2015 @ 23:18
    Clickfarm
    0

    Thanks, but I want to be able to set on each item that i have added to the form whether or not to show the label.  some FieldTypes i have changed to show the label as a placeholder inside the input, others i want to still display the label.

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jan 30, 2015 @ 23:25
    Dennis Aaen
    0

    Hi Matt,

    Okay then try to have a look on this documentation about how to add settings to a field type.http://our.umbraco.org/documentation/Products/UmbracoForms/Developer/Extending/Adding-a-Type#Addingsettingstoatype and http://our.umbraco.org/documentation/products/umbracoforms/Developer/Extending/Adding-a-Fieldtype.

    Perhaps you can extend the field types that Umbraco Forms comes shipped with. The files for the fields types in this folder /Views/Partials/Forms/Fieldtypes

    Hope this helps,

    /Dennis

  • Clickfarm 77 posts 161 karma points
    Jan 30, 2015 @ 23:29
    Clickfarm
    1

    ok thanks, so on line 75 of the Forms.cshtml file where it has "@if (!f.HideLabel)", there's no way to set the value of that?  where is it getting the value for that property then?

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jan 31, 2015 @ 00:05
    Dennis Aaen
    100

    Hi Matt,

    It is because that you have the possibility to hide and show inputs, depending on some conditions. An example let´s say that you have a check box list where the user can choose how he wants to be concacted, then he can set a tick in phone or email. Depending on which checkbox is check then you can show the phone field or the email field.

    You can read about conditions here: http://our.umbraco.org/documentation/Products/UmbracoForms/Editor/Creating-a-form/Conditional-Logic/

    Hope this helps,

    /Dennis

  • Clickfarm 77 posts 161 karma points
    Jan 31, 2015 @ 00:08
    Clickfarm
    0

    Understood. Thanks for your explanation.

  • steve sonius 1 post 71 karma points
    Oct 12, 2016 @ 04:05
    steve sonius
    0

    I'm pretty sure you have sorted this out by now .. so for people who are new, like me.. I might lay it down as I see it..

    If you want to hide a label for a specific field, you are breaking out of the forms standard form types and you need to create a CUSTOM field type. you can do that in a few easy steps following the the instructions on this page..

    Adding a field type to Umbraco Forms

    All you need to do is add and set this property in the constuctor...

    this.HideLabel = true;
    
Please Sign in or register to post replies

Write your reply to:

Draft