Created
April 23, 2012 10:10
-
-
Save nootn/2470080 to your computer and use it in GitHub Desktop.
MVC Mega Forms quick start guide - ChangeVisually
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Supply defaults for MegaForms | |
var MegaFormsChangeVisuallyJQueryParentContainerSelector = '.container'; //sets the class of a component that wraps a whole form control (I.e. label + input + validation message) | |
var MegaFormsChangeVisuallyJQueryHideEffect = 'fast'; //sets the jQuery effect to use when hiding a field | |
var MegaFormsChangeVisuallyJQueryShowEffect = 'slow'; //set the jQuery effect to use when showing a field |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PM> Install-Package MvcMegaForms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This will show as a checkbox on the screen - checking it will show "TheNextHidingField" | |
public bool ShowTheNextHidingField { get; set; } | |
[ChangeVisually(ChangeVisuallyAttribute.ChangeTo.Hidden, "ShowTheNextHidingField", ChangeVisuallyAttribute.DisplayChangeIf.Equals, false, false)] | |
public string TheNextHidingField { get; set; } | |
//This will show as a checkbox on the screen - checking it will enable "TheNextDisabledField" | |
public bool EnableTheNextDisabledField { get; set; } | |
[ChangeVisually(ChangeVisuallyAttribute.ChangeTo.Disabled, "EnableTheNextDisabledField", ChangeVisuallyAttribute.DisplayChangeIf.Equals, false, false)] | |
public string TheNextDisabledField { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<fieldset> | |
<legend>Please fill in the form</legend> | |
<ol> | |
<li class="container"> | |
@Html.LabelFor(m => m.ShowTheNextHidingField) | |
@Html.CheckBoxFor(m => m.ShowTheNextHidingField) | |
@Html.ValidationMessageFor(m => m.ShowTheNextHidingField) | |
</li> | |
<li class="container"> | |
@Html.LabelFor(m => m.TheNextHidingField) | |
@Html.TextBoxFor(m => m.TheNextHidingField) | |
@Html.ValidationMessageFor(m => m.TheNextHidingField) | |
</li> | |
<li class="container"> | |
@Html.LabelFor(m => m.EnableTheNextDisabledField) | |
@Html.CheckBoxFor(m => m.EnableTheNextDisabledField) | |
@Html.ValidationMessageFor(m => m.EnableTheNextDisabledField) | |
</li> | |
<li class="container"> | |
@Html.LabelFor(m => m.TheNextDisabledField) | |
@Html.TextBoxFor(m => m.TheNextDisabledField) | |
@Html.ValidationMessageFor(m => m.TheNextDisabledField) | |
</li> | |
</ol> | |
<input type="submit" value="submit" /> | |
</fieldset> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment