Hi everyone.
I really need som help on this. I will do my best to explain the issue I'm on.
I use the great Validation Plugin from Jörn Zaefferer to validate my Forms. Everything is just fine, but since I tried to implement the "success:function(label) {}" thing I can`t get it right.
The worst part is that I'm doing the basic of the documentation:
- success: function(em) {
- em.text("Ok!").addClass("valid");
- },
The question is that the "transformation" of the label [em in my case] is doing fine, but the image of the little nice blue check icon doesn't locate next to the input, it goes down:
As you see the error label or em or whatever is correctly shown, but when it becomes "valid"
It just goes DOWN !!!!!
I leave you guys my validate() and my CSS codes ...
The funny thing is that with the Firebug, it shows me on the generation of the valid label, a "display:block" attribute, and if I block it on Firebug the label goes where it belongs, see:
Here is the jQuery code:
- $("#frmBusquedaPropia").validate({
- debug: true,
- errorElement: "em",
- success: function(em) { // Here is my problem ??
- em.text("Ok!").addClass("valid"); // At least is with this
- },
- errorPlacement: function(error, element) {
- error.insertAfter(element);
- },
- submitHandler: function(form) {
- $.ajax({
- type: "POST",
- url: $("#"+form.id).attr("action"),
- data: $("#"+form.id).serialize(),
- success: function(data) {
- $("#searchResultsPropio").empty().html(data);
- },
- error: function(e) {
- if (e.description == null) {
- alert(e.message);
- } else {
- alert(e.description);
- }
- }
- });
- $("*[generated='true']").remove();
- },
- rules: {
- // My rules are here
- },
- messages: {
- // My custom messages are here
- }
- });
And here is the CSS:
- em.error {
- background:#FEF1EC url("../images/gen/unchecked.gif") no-repeat 5px 4px;
- border:1px dotted;
- color:#CD0A0A;
- font-size:1em;
- margin-left:5px;
- padding:5px 18px;
- position:absolute;
- text-align:center;
- width:300px;
- }
- em.valid {
- background: url('../images/gen/checked.gif') no-repeat 2px 6px;
- border:none;
- color:#222222;
- height:16px;
- width:16px;
- position: absolute;
- padding:6px 18px;
- }
- input.error {
- background-color:#FEF1EC;
- border:2px dotted #CD0A0A;
- }
So guys, what possible could be wrong besides my brain ???
I really need a clue, I accept working code to :-P
Is just a CSS positioning issue ? Or display ? If you need I'll post you my HTML too, but is just that, pure HTML ...
Thanks in advance for the help.