JQuery :: Validate Breaks When Supplying Additional Metadata
Nov 12, 2010
I am working on a web form which uses jquery validate for validation and a (custom-built) plugin for ajax support. My plugin supports metadata (using the jquery metadata plugin) for supplying information about the form and how the ajax request should be handled. The problem is that when I add such metadata to the form, jquery.validate tries to find matching rules and crashes because those don't exist when validating the form.
For example my form tag might look like this:
<form class="{this_is_just_some_random_metadata:true}" ...>
And this crashes jquery validate.
The problem is easy to fix by modifying the check function in jquery.validate, but I am wondering whether I might be missing something. Certainly I can't be the first guy to use the metadata plugin for both validation and other purposes.
I would like to display file extension along with the file links on a web page. For example, I would like to append (pdf) next to any pdf links. The following code works to some extent but not as I intended. $("a[href$='.pdf']").append(" (" + 'pdf' + ") "); If I use the above code, (pdf) is also underlined being part of the link. I want (pdf) next to the link and not as part of the link.
I wanted to define additional attribute to a tag to manage information. I realized that XHTML might not like it and discovered the data(name,value) function. I was wondering how I could retrieve all tags e.g. "div" that have that data variable set.
I have problem about mouse hover in JQuery, the problem is that the main image not change when I move from additional image 1 to additional image 2. My site sample : [URL]. It work when I move to other additional with move mouse slowly.
This my code : $(document).ready(function(){ $('#thumbs a').hover( function() { var currentBigImage = $('#image img').attr('src'); var newBigImage = $(this).attr('href'); var currentThumbSrc = $(this).attr('rel'); switchImage(newBigImage, currentBigImage, currentThumbSrc); }, function() { var currentBigImage = $('#image img').attr('src'); var newBigImage = '[URL]'; var currentThumbSrc = $(this).attr('rel'); switchImage(newBigImage, currentThumbSrc, currentBigImage); } ); function switchImage(imageHref, currentBigImage, currentThumbSrc) { var theBigImage = $('#image'); if (imageHref != currentBigImage) { theBigImage.fadeOut(250, function(){ theBigImage.attr('src', imageHref).fadeIn(250); var newImageDesc = $("#thumbs a img[src='"+currentThumbSrc+"']").attr('alt'); }); } } });
I know its a cliche but I am new to JQuery. I have seen many posts about passing function as parameter but none is what I am looking for. Not too sure if its possible but no harm asking.I have a function that trigger a modal
function InitNewModal(URI,Title,Width,Height,Params) { // Begin modal function
Is it possible to add additional data to the forms plugin options before submitting an ajax form, this would be only setting the data option after setting the main submit options previously in an object?
I must be missing something, is there not an easy way to validate inline?
For example, I have a required text input that is given focus on page load, I would like for it to throw an error if the user moves to the next field w/o entering any data.
Have a asp.net mvc project using jquery-ui-1.7.2. and BlockUI. When I changed jQuery version from 1.3.2 to 1.4.1, the CSS pertaining to the block ceased to render. The functions fired (verified by in-line alerts) and firebug had no complaints. Moved back to 1.3.2 and the blocker rendered perfectly.
im loading data via json dynamical from the server. Now i try to optimate the speed of my application and so i want to disable the validate of the fields during the data loading from the server.Is there a simple solution to this? like validate = false
I have a form (form1) to register with the fields: user, email, password being validated normally.
Have a second form (Form2) to the user update the data registered in form1, and the fields user, email, password is already populated with data from the database, the email field I use the remote validation, and as the field already has been completed and read always says that this email already exists, how do I create a rule or method so that when the field is already filled it not do so validating and validate if it is filled with a new email. Email2 have a hidden field in order to do a test type.
This one is throwing me. I have a small piece of code that I am using to call a function in dynamic drive's accordion menu script. As long as I leave the alert() line in, it works. Comment it out and the call to expandone() doesn't go through. I must be missing something obvious, no? Here's the relevant part of the code (it is fired from $(document).ready() ):
I am using jquery append to add a div(a fairly long html string) to my content wrapper. But when appending it the lightbox function breaks. The site is at: [URL].The first box with the info filled in is an div that is in the html and the lightbox works. The second box is the one inserted with append and the lightbox is broke. The class attributes seem intact and I cannot figure out why it is broken.
I'm working under certain constraints wherein,at a certain point outside my direct control,validate is called with no arguments, but after that I want to set a custom validation function on a form field. I figure there's got to be a way to manipulate validate's internal data structure to add the function, but I don't have a clue as to how.
I have a section of a form containing elements that are not visible, currently just in a hidden div. Some of these elements have validation on them so when the form is submitted it fails on this validation.What I am after is a way to stop the validation firing for any hidden elements. I have tried setting them to 'display: none' and 'visibility: hidden' but this does not have any affect.
dt_save is a <form>, the submit trigger works as usual but when doing an Ajax request the code interrupts without any error. I put in 2 alert's just to check, only the first alert box appears when submitting the form. Also I can't find my request in Firebug's Network window (Firefox addon).
How do I make line breaks in my xml file? This is what I got in my <head>: <script type="text/javascript"> $(document).ready(function(){ $('.quotes').randomContent({xmlPath: "xml/quotes.xml", nodeName: "quote"}); }); </script>
As you can see, it takes a random quote from my xml file. But I have some long quotes which I want to line break like this: <quote> This is a verry verry verry verry <line break> ... long quote. </quote>
I'm working with a Drupal site and am trying to stay within the results of a Drupal view.I'm using Cycle to rotate through a bunch of images created by this view, and I want to use an ajax "page refresh" to check for new content. I get the new content just fine, but then cycle breaks. Here is my function:
function ajaxRefresh(){ $.post('my_site', function(data){
If I use remove() instead of hide(), or if I use trigger('update'), the pager drops all pages except the current one. I'd like to use remove(), and ideally the a row that is deleted would be replaced by one from the next page. I thought that trigger('update') was supposed to do that for me.[code]...
I have a click function that works perfectly when you click so. As soon as there's an animation on toggle() such as Blind or Slide, it no longer toggles.
here's my code: // Accordion $('#accordion h3').click(function() { $(this).next().toggle('blind'); $(this).toggleClass('ui-state-active');
[Code]....
When I change it to toggle() with no animation, works perfectly fine and I can click as fast as I want.
what should I do to say if it's already animated. is(":animated") ?
Below is a very simple jquery slideshow script which functions exactly as it should. But, if I link an image in the DIV set (See proposed change section) the slideshow breaks, instead of cycling through each image in turn it keeps trying to cycle the first image over and over. Script linking in header of HTML page:
<script type="text/javascript" src="script/jquery-1.2.6.min.js"></script> <script type="text/javascript" src="script/slideshowsc.js"></script> CSS on HTML controlling DIV position/opacity
Finally, Javascript / Jquery fired through body tag onload function slideSwitch() { var $active = $('#slideshow IMG.active'); if ( $active.length == 0 ) $active = $('#slideshow IMG:last'); // use this to pull the images in the order they appear in the markup var $next = $active.next().length ? $active.next() : $('#slideshow IMG:first');
// uncomment the 3 lines below to pull the images in random order // var $sibs = $active.siblings(); // var rndNum = Math.floor(Math.random() * $sibs.length ); // var $next = $( $sibs[ rndNum ] );
The jQuery breaks in IE8. If you click the first image on this page, either one of two things will happen the PNG file will load or nothing will happen. To understand compare in FireFox/Chrome.
using the ajax function ($.ajax()) to send the value of a textarea to an php file. This works fine. But the data, which i`m sending to to the php file, is without any line-breaks.Here is my ajax request:
var myTextareaVal = $('#message-textarea').val(); $.ajax({ type: "GET",