Copied to clipboard

Flag this post as spam?

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


  • MK 429 posts 906 karma points
    Jan 15, 2013 @ 14:33
    MK
    0

    Conditional option is not working in razor

    Hi there,

    Trying to add condition to a field when someone chooses a radio button the field will show up.

    It is not showing up.

    Im using the default Form.cshtml...

    Am I missing anything?

    Thanks

    mkariti

  • Comment author was deleted

    Jan 15, 2013 @ 14:44

    Just tested and it works, do you get any js errors?

  • Comment author was deleted

    Jan 15, 2013 @ 14:47

    Does it work when you preview the form from the Contour section?

  • Comment author was deleted

    Jan 15, 2013 @ 14:47

    Maybe you forgot to hit the add button after setting the condition, try checking the field and make sure that the rule is there

  • Comment author was deleted

    Jan 15, 2013 @ 14:49

    Should look something like

  • MK 429 posts 906 karma points
    Jan 15, 2013 @ 21:05
    MK
    0

    Hi Tim,

    1. No JS errors

    2. It works in the preview mode.

    Thanks

    mkariti

  • Comment author was deleted

    Jan 16, 2013 @ 10:03

    Ok then you probably have on issue on your template, did you include the necessary scripts?

  • MK 429 posts 906 karma points
    Jan 16, 2013 @ 10:09
    MK
    0

    Hi Tim, 

    Yes Ive included the required JS.

    Im just going onver it. any chance you can tell me what activate the show and hid condition?

    Is it a css selector?

    thanks

  • Comment author was deleted

    Jan 16, 2013 @ 10:22

    You can check the code in /umbraco/plugins/umbracocontour/scripts/frontend/contourform.js

    this line is important  $(".contourPage input").change(function() {

    so you have to leave the .contourPage class on the surrounding form div

    and to show hide it does

    $("#1e711925-9f38-48c5-a16a-63ee967e2a56").parent(".contourField").show();

    so you need a contourField class on the div containing the field and label

  • Josh Olson 79 posts 207 karma points
    Jan 16, 2013 @ 15:12
    Josh Olson
    0

    Sorry if I am a little slow, but I am having a similar problem and I cannot figure out the next step.  I have conditional logic that shows a field if another field is not empty.  In preview mode it works fine, but on my page it does not fire.  I know I have missed something because the validation dosen't fire until I hit the 'submit' button, unlike in the preview mode where it fires as soon as I tab out of the field.

    What are the 'necessary scripts' you alluded to above needing to be included in the template? I have followed the directions found in the readme.txt to set up for custom markup for a specific template as such:

    Custom markup for your Contour forms
    ----------------------------
    It's possible to update the default view for the Contour form and fieldtypes, 
    making it possible to have complete control over your form markup.
    You can do this for al your forms or for a single form.
    
    To do this for all your forms simply update the default views:
    ~\umbraco\plugins\umbracoContour\Views\Form.cshtml (view for the form, including page name, fieldset, legend, field container)
    ~\umbraco\plugins\umbracoContour\Views\FieldType.*.cshtml (view for a specific field type like textfield, datepicker, ...)
    
    If you want to do this for a specific form you'll need to create the following folder:
    ~\umbraco\plugins\umbracoContour\Views\Forms\{FormId}\ (FormId needs to be an existing form id, you can view the id of the form on the settings tab of the form designer)
    
    As an example if your form id is 85514c04-e188-43d0-9246-98b34069750c then you can overwrite the form view by adding the Form.cshtml file to the directory
    First copying the default one and then making your changes is the best way to get started
    ~\umbraco\plugins\umbracoContour\Views\Forms\85514c04-e188-43d0-9246-98b34069750c/Form.cshtml
    
    You can also overwrite views for 1 or more fieldtypes by adding the views to the folder (again if you first copy the default one and then make your changes...)
    ~\umbraco\plugins\umbracoContour\Views\Forms\85514c04-e188-43d0-9246-98b34069750c\Fieldtype.Textfield.cshtml
    
    A final option is to overwrite the view for a specific field on a form (if you want to target a specific field but not all fields of this type)
    ~\umbraco\plugins\umbracoContour\Views\Forms\85514c04-e188-43d0-9246-98b34069750c\FieldNameWithoutSpaces.cshtml
    

    but I have not made any changes to any of the original files, I only copy/pasted them into their new homes.

    We have need for a complex form and I am trying to sort out if Contour 3 is the correct solution for us, but the lack of documentation is creating a signifigant stumbling block for me.  I previously looked at Countour 2, but the lack of support for conditional logic and custom markup turned me away.  The inclusion of these two features in Contour has again sparked my interest, but first I have to be able to sort out what seems to be some basic steps.

    Any pointers would be very helpful!

    Thanks!

  • Comment author was deleted

    Jan 16, 2013 @ 15:13
  • Comment author was deleted

    Jan 16, 2013 @ 15:14

    In that case they are hosted third party but you can also use the ones the contour preview uses (check the source for that page) or roll out your own (if you are using a different jquery version)

  • Josh Olson 79 posts 207 karma points
    Jan 16, 2013 @ 15:17
    Josh Olson
    0

    Cheers Tim, that was exactally what I needed.  I knew it was a simple oversight on my part!

  • MK 429 posts 906 karma points
    Jan 16, 2013 @ 15:20
    MK
    0

    I found out that my problem is conflict between jquery plugin that mask my control to the jquery validation. I literally been sitting on it for the past 2 hours with little success..........Hope you'll have better luck than me.

Please Sign in or register to post replies

Write your reply to:

Draft