Skip to content

Instantly share code, notes, and snippets.

@markphi2013
Created March 22, 2013 15:04
Show Gist options
  • Save markphi2013/5221951 to your computer and use it in GitHub Desktop.
Save markphi2013/5221951 to your computer and use it in GitHub Desktop.
css validation Bug on dialogue and request
.ttc-validation-error {
position: absolute;
left: -700px;
top: -50px;
top: -35px\9;
background: pink;
border: solid white;
padding: 5px;
font-size: 12px;
}
.ttc-radio-validation-error {
left: 30px;
}
.ttc-textarea-validation-error {
/* position: relative;*/
/*left: 170px;*/
top : -96px;
top: -52px\9;
}
.ttc-textarea-validation-error.request {
left: -695px;
}
.ttc-textarea-validation-error.dialogue{
left: 191px;
top : -113px;
top: -59px\9;
}
.ttc-input-validation-error {
top: -49px;
top: -64px\9;
left: 191px\9;
}
/*Chrome hack*/
@media screen and (-webkit-min-device-pixel-ratio:0) {
.ttc-validation-error{ top: -32px; }
.ttc-radio-validation-error{ top: -38px;}
.ttc-textarea-validation-error {top: -60px; left: 170px}
.ttc-input-validation-error {left: 198px; top: -61px;}
.ttc-textarea-validation-error.dialogue {top: -60px}
.ttc-textarea-validation-error.request {top: -60px; left: 170px;}
}
$("textarea[name*='content']").each(function (item) {
// if($("content[name*='question-answer']")){
if($("textarea[name*= 'interaction[2].content']")){
$(this).rules("add",{
required:true,
messages:{
required: wrapErrorMessageInClass(localized_errors.validation_required_content, "ttc-textarea-validation-error dialogue"),
}
});
}else{
$(this).rules("add",{
required:true,
messages:{
required: wrapErrorMessageInClass(localized_errors.validation_required_content, "ttc-textarea-validation-error "),
}
});
}
});
@overnin
Copy link

overnin commented Mar 22, 2013

you don't need the if in the ttc-generic-program.

You need to add the class "dialogue" at the dynamic form root element!

then in the basic.css (see below the space between the 2 class => cascading)

.dialogue .ttc-textarea-validation-error {}

.request .ttc-textarea-validation-error {}

@overnin
Copy link

overnin commented Mar 22, 2013

The the class dialogue or request are add to the element with id=dynamic-generic-program-form

in View/ProgramDialogues/edit.ctp line 51
Html->tag('form', null, array(' id'=> 'dynamic-generic-program-form', 'class' => 'request')); ?>

@markphi2013
Copy link
Author

when i add 'class' => 'request' to the edit dialogue file this only attaches to request class to the dialogue and so when i select question from the interactions, save with content empty there is no error message cause the dialogue Css class is not presented any where in file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment