Beauty = Monorail + Validation + Active Record + (IE * Grief)
So I started playing with monorail today. It’s a very intelligent platform that I will continue to blog about. I got a sample setup very quickly thanks to Ayende’s
screen cast. The next step I wanted to play with was validation. Hamilton Verissimo has a nice screen cast showing off the new functionality with javascript agnostic code. Very cool that MR insulates you from a particular javascript library.
Two problems quickly arose:
- MR Validation does not like AR Validators
- ActiveWriter generates AR Validators and I needed to generate Castle.Component.Validator.
- IE did not like hammett’s use of <p> tags in the demo. Change to <div> or use a nicer layout with lists.
All-in-all, very cool functionality. And if you want the styling as seen in hammett’s screen cast, here is the css.
input.disabled {
border: 1px
solid
#F2F2F2;
background-color: #F2F2F2;
}
input.required, textarea.required {
border: 1px
solid
#00A8E6;
}
input.validation-failed, textarea.validation-failed {
border: 1px
solid
#FF3300;
color : #FF3300;
}
input.validation-passed, textarea.validation-passed {
border: 1px
solid
#00CC00;
color : #000;
}
.validation-advice {
margin: 5px
0;
padding: 5px;
background-color: #FF3300;
color : #FFF;
font-weight: bold;
}
.custom-advice {
margin: 5px
0;
padding: 5px;
background-color: #C8AA00;
color : #FFF;
font-weight: bold;
}
Tags: .net, castle, monorail