jQuery validation plugin - not setting focus in Webkit browsers -
Hope you can help .. I am using the address entry form in the AAP.NET MVC project.
I'm really trying to figure out whether I should go through a validity plugin and webkit browser (like Safari, Chrome) or jQuery and WebKit Browser before going on a bug-hunting mission (Although I've been wasted several hours already and have not found anywhere: ()
We've got a MVC master page, in which the & lt; head & gt; section Validate: ( The displayErrorMessage () function looks like this: Where #userMessages is a div on top of the page to display an error message summary as a banner. (Eg 'There is a problem with your delivery address Please fix the errors below') All of this works fine in all browsers, except webkit browsers (like Safari, Chrome). In these browsers, the validation plugin, after verifying, should set the input focus on the invalid field first. This webkit does not do this in the browser, in Safari, for example, the thick blue box appears around the correct area, but the cursor does not appear in the field, and there is no focus in it. After unsuccessful attempt to submit the form - say the phone number was empty - client side error messages appear as expected, when you start typing, say, phone number field, 'on- Up 'code (which validates the form and if it is valid, gives the correct), it shows that it is no longer empty (empty), and remove the error message summary banner (#userMessages) . Although all browsers in Safari remove banners properly, the field loses focus, even if the thick blue box stays on the area. Then the keystrokes are lost and you have to click back to continue on the phone number field. Hope you can help me at the loss! Thank you in advance ed
function display error message (msg) {$ ("# error message"). Remove (); $ ("# Usermessages") Attachment ('& lt; div id = "error message" & gt;' + msg + '& lt; / div & gt;'); }
I cracked it !
I created a test page in a separate project, with a very basic skeleton form. Then I slowly added scripts and markup to the test page from the original page, checked it every time in Safari. Nothing breaks the safari until I added the reference to our css file, and then it stopped working!
I searched a binary-style via CSS, unless I limit it to one line:
input Terror {float: left; Red color; Vertical-alignment: top; Align text: left; }
This style has been implemented in the input field from the valid input plugin which is in error.
It was 'float: left' which was breaking safari and chrome.
To get rid of some minor changes to CSS and now it works! It seems a bit weird that a float: the left should be the reason for this problem, though ....
ed
Comments
Post a Comment