Copied to clipboard

Flag this post as spam?

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


  • aaeda 106 posts 138 karma points
    Jul 23, 2014 @ 09:34
    aaeda
    0

    Creating form with code first and conditional logic

    Hi

    I am creating a form using code first and conditional logic. However, I am having an error message on displaying the form 'Sequence contains no matching element' when adding the conditional rule. Please refer to the code below. Can you please advise where am I going wrong? Thanks

      [Field(FormPages.InscriptionForme, FormFieldsets.Details, Caption = "Je suis un membre", Type = typeof(RadioButtonList), Prevalues = new[] { "Oui", "Non" }, Mandatory = true)]
        public string Membertest {get; set;}
    
        [Field(FormPages.InscriptionForme, FormFieldsets.Details, Caption = "Compagnie / Company", Type = typeof(DropDownList), Prevalues = new[] { "test1", "test2" }, Mandatory = true, EnableCondition= true, ConditionActionType = FieldConditionActionType.Show, ConditionLogicType = FieldConditionLogicType.Any)]
        [FieldConditionRule("Membertest", FieldConditionRuleOperator.Is, "Oui")]
        public string Hidden { get; set; }
    
  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 22, 2014 @ 21:18
    Fuji Kusaka
    0

    Hey Aaeda,

    Have you been able to get the conditional logic working on this ? 

    //fuji

  • aaeda 106 posts 138 karma points
    Oct 24, 2014 @ 07:28
    aaeda
    0

    Hi Fuji

    Yes I got it working! it's been a while already :)

    Aaeda

  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 24, 2014 @ 07:58
    Fuji Kusaka
    0

    Any suggestions how you managed to get it working  ?

    Am working with a custom field Label but cant get the conditional logic to work. 

     public class DCLabel : FieldType
        {
            [Umbraco.Forms.Core.Attributes.Setting("Text to Display ", prevalues = "", description = "Enter the text to show in the label", control = "Umbraco.Forms.Core.FieldSetting.TextArea")]
            public string LabelToShow { get; set; }
  • aaeda 106 posts 138 karma points
    Oct 24, 2014 @ 08:25
    aaeda
    0

    Hi Fuji

    I don't see the conditional logic you are trying to do. In the code you sent, you are only creating the field.

    A.

  • Fuji Kusaka 2203 posts 4220 karma points
    Oct 24, 2014 @ 08:32
    Fuji Kusaka
    0

    Sorry here is the code

    [Field("test", "test",  EnableCondition = true, ConditionActionType = FieldConditionActionType.Show, ConditionLogicType = FieldConditionLogicType.Any)]

            [FieldConditionRule("LabelToShow", FieldConditionRuleOperator.Is, "True")]

            public string Hidden { get; set; }

  • Chester Campbell 62 posts 120 karma points
    Jan 14, 2015 @ 18:46
    Chester Campbell
    0

    Aaeda ... I am having the same problem (my post about it is: http://our.umbraco.org/forum/umbraco-pro/contour/60438-Codefirst-form-error-Sequence-contains-no-matching-element,-multiple-fields-in-db). Would you mind sharing the solution since you got your form working?

    Thank you! chester

  • aaeda 106 posts 138 karma points
    Jan 15, 2015 @ 06:10
    aaeda
    0

    Hello Chester

    For the conditional logic to work, you need to add a dummy condition like for example, [FieldConditionRule("Field name", FieldConditionRuleOperator.Is, " ")]

    For the 'Code Sequence' error, you need to check that you are not using the same field names anywhere.

    Hope this helps.

    Regards Aaeda

Please Sign in or register to post replies

Write your reply to:

Draft