[jQuery] Re: Only one of two fields is required. How to implement this logic in Jquery form validation?
Hi , I double checked on javascript's XOR operator and it only works with bitwise: so you will have to write your own XOR . This isn't hard : [code] if (!foo != !bar) [\code] should work for all elements. or this [code]if( ( foo !bar ) || ( !foo bar ) )[\code] For the validator method I haven't actually tried to run this but you can try this:[code] $.validator.addMethod( onlyCheckOne, function(value, elements) { // but put whatever you're using to see if either is checked in the next line return this.optional(value) || elements[o]:checked XOR elements[1]:checked; }, Please check either participations or days, but not both )[/code] note change XOR to whatever method you decide to use. Then add the check to your rules. DED On Mon, Oct 12, 2009 at 12:36 AM, Phper hi.steven...@gmail.com wrote: script type=text/javascript src=http://code.jquery.com/jquery- latest.js/script script type=text/javascript src=http://dev.jquery.com/view/trunk/ plugins/validate/jquery.validate.js/script script type=text/javascript !-- $(document).ready(function() { $(#form1).validate({ rules: { title: { required: true, minlength:40 } , content: { required: true, minlength:100, maxlength:600 }, evaluation: { required: true, minlength:50, maxlength:300 }, price: { required: true, digits:true }, multi:{ required:true } }, messages: { } }); }); -- /script As you can see from the code above, title, content, evaluation, prices and multi are required. All of them are required. But there are additional two fields, which are participations and days. Only one of them is required. Either participations or days is required. How to write this code? On Oct 12, 10:17 am, Phper hi.steven...@gmail.com wrote: A good clue. But I still don't know where to write the if statement. It would be good if you can give me an example. On Oct 11, 10:57 pm, Don Dunbar salemd1s...@gmail.com wrote: Hi, if you are using the validation plugin, I believe it has a function addMethod that allows you to write your own method for the validation. It requires a name (javascript identifier), a method to check input against ( in your case A and B would be checked for completion) and a message to display when there is an error (i.e. neither A nor B is filled out, or both are). You can get the details for using the addMethod function at the jQuery Docs page.http://docs.jquery.com/Plugins/Validation The page lists demos and the function you need is toward the bottom of the page. The logic is fairly straight forward : when the form is being filled out listen for when A and B have focus, remember if either is checked or ignored and check to make sure both are not simultaneously filled out. Check this on submit as well. Good luck, DED On Sun, Oct 11, 2009 at 7:42 AM, Phper hi.steven...@gmail.com wrote: How can I write the code in the context of Jquery validate function? On Oct 11, 12:43 pm, Don Dunbar salemd1s...@gmail.com wrote: Hi, javascript has an 'xor' operator. It works just like 'or' in an 'if' statement except in 'xor' only one side can be true. In a normal 'or' statement either side can be true or both can. So you probably want to do something like: if ( A XOR B) { } . Then only one can be true to continue if both are true the statement returns 'false'.Hope this helps. DED On Sat, Oct 10, 2009 at 10:37 PM, Phper hi.steven...@gmail.com wrote: There are two input fields in a form, but only one of them is required, they are not required at the same time. Either A or B is required. ( A is required OR B is required). In other words, a user can input data to field A, or he can input data to filed B, but he can not input data to Both A and B at the same time. How to implement this constraint in Jquery form validation?
[jQuery] Re: Only one of two fields is required. How to implement this logic in Jquery form validation?
whats the problem? just check one field, it it is filled then do not check other. may be your problem is something else On Oct 11, 8:37 am, Phper hi.steven...@gmail.com wrote: There are two input fields in a form, but only one of them is required, they are not required at the same time. Either A or B is required. ( A is required OR B is required). In other words, a user can input data to field A, or he can input data to filed B, but he can not input data to Both A and B at the same time. How to implement this constraint in Jquery form validation?
[jQuery] Re: Only one of two fields is required. How to implement this logic in Jquery form validation?
I am not familiar with the syntax of Jquery plugin. On Oct 12, 2:19 pm, Don Dunbar salemd1s...@gmail.com wrote: Hi , I double checked on javascript's XOR operator and it only works with bitwise: so you will have to write your own XOR . This isn't hard : [code] if (!foo != !bar) [\code] should work for all elements. or this [code]if( ( foo !bar ) || ( !foo bar ) )[\code] For the validator method I haven't actually tried to run this but you can try this:[code] $.validator.addMethod( onlyCheckOne, function(value, elements) { // but put whatever you're using to see if either is checked in the next line return this.optional(value) || elements[o]:checked XOR elements[1]:checked; }, Please check either participations or days, but not both )[/code] note change XOR to whatever method you decide to use. Then add the check to your rules. DED On Mon, Oct 12, 2009 at 12:36 AM, Phper hi.steven...@gmail.com wrote: script type=text/javascript src=http://code.jquery.com/jquery- latest.js/script script type=text/javascript src=http://dev.jquery.com/view/trunk/ plugins/validate/jquery.validate.js/script script type=text/javascript !-- $(document).ready(function() { $(#form1).validate({ rules: { title: { required: true, minlength:40 } , content: { required: true, minlength:100, maxlength:600 }, evaluation: { required: true, minlength:50, maxlength:300 }, price: { required: true, digits:true }, multi:{ required:true } }, messages: { } }); }); -- /script As you can see from the code above, title, content, evaluation, prices and multi are required. All of them are required. But there are additional two fields, which are participations and days. Only one of them is required. Either participations or days is required. How to write this code? On Oct 12, 10:17 am, Phper hi.steven...@gmail.com wrote: A good clue. But I still don't know where to write the if statement. It would be good if you can give me an example. On Oct 11, 10:57 pm, Don Dunbar salemd1s...@gmail.com wrote: Hi, if you are using the validation plugin, I believe it has a function addMethod that allows you to write your own method for the validation. It requires a name (javascript identifier), a method to check input against ( in your case A and B would be checked for completion) and a message to display when there is an error (i.e. neither A nor B is filled out, or both are). You can get the details for using the addMethod function at the jQuery Docs page.http://docs.jquery.com/Plugins/Validation The page lists demos and the function you need is toward the bottom of the page. The logic is fairly straight forward : when the form is being filled out listen for when A and B have focus, remember if either is checked or ignored and check to make sure both are not simultaneously filled out. Check this on submit as well. Good luck, DED On Sun, Oct 11, 2009 at 7:42 AM, Phper hi.steven...@gmail.com wrote: How can I write the code in the context of Jquery validate function? On Oct 11, 12:43 pm, Don Dunbar salemd1s...@gmail.com wrote: Hi, javascript has an 'xor' operator. It works just like 'or' in an 'if' statement except in 'xor' only one side can be true. In a normal 'or' statement either side can be true or both can. So you probably want to do something like: if ( A XOR B) { } . Then only one can be true to continue if both are true the statement returns 'false'.Hope this helps. DED On Sat, Oct 10, 2009 at 10:37 PM, Phper hi.steven...@gmail.com wrote: There are two input fields in a form, but only one of them is required, they are not required at the same time. Either A or B is required. ( A is required OR B is required). In other words, a user can input data to field A, or he can input data to filed B, but he can not input data to Both A and B at the same time. How to implement this constraint in Jquery form validation?
[jQuery] Re: Only one of two fields is required. How to implement this logic in Jquery form validation?
I thought of a much simpler solution. If possible could you use radio buttons for those two choices in your HTML? In a radio button group selecting one automatically deselects other buttons in the group. Then you could just use one of the built in validation checks, as you already have done, to make sure one is checked.DED On Mon, Oct 12, 2009 at 1:43 AM, Phper hi.steven...@gmail.com wrote: I am not familiar with the syntax of Jquery plugin. On Oct 12, 2:19 pm, Don Dunbar salemd1s...@gmail.com wrote: Hi , I double checked on javascript's XOR operator and it only works with bitwise: so you will have to write your own XOR . This isn't hard : [code] if (!foo != !bar) [\code] should work for all elements. or this [code]if( ( foo !bar ) || ( !foo bar ) )[\code] For the validator method I haven't actually tried to run this but you can try this:[code] $.validator.addMethod( onlyCheckOne, function(value, elements) { // but put whatever you're using to see if either is checked in the next line return this.optional(value) || elements[o]:checked XOR elements[1]:checked; }, Please check either participations or days, but not both )[/code] note change XOR to whatever method you decide to use. Then add the check to your rules. DED On Mon, Oct 12, 2009 at 12:36 AM, Phper hi.steven...@gmail.com wrote: script type=text/javascript src=http://code.jquery.com/jquery- latest.js/script script type=text/javascript src=http://dev.jquery.com/view/trunk/ plugins/validate/jquery.validate.js/script script type=text/javascript !-- $(document).ready(function() { $(#form1).validate({ rules: { title: { required: true, minlength:40 } , content: { required: true, minlength:100, maxlength:600 }, evaluation: { required: true, minlength:50, maxlength:300 }, price: { required: true, digits:true }, multi:{ required:true } }, messages: { } }); }); -- /script As you can see from the code above, title, content, evaluation, prices and multi are required. All of them are required. But there are additional two fields, which are participations and days. Only one of them is required. Either participations or days is required. How to write this code? On Oct 12, 10:17 am, Phper hi.steven...@gmail.com wrote: A good clue. But I still don't know where to write the if statement. It would be good if you can give me an example. On Oct 11, 10:57 pm, Don Dunbar salemd1s...@gmail.com wrote: Hi, if you are using the validation plugin, I believe it has a function addMethod that allows you to write your own method for the validation. It requires a name (javascript identifier), a method to check input against ( in your case A and B would be checked for completion) and a message to display when there is an error (i.e. neither A nor B is filled out, or both are). You can get the details for using the addMethod function at the jQuery Docs page.http://docs.jquery.com/Plugins/Validation The page lists demos and the function you need is toward the bottom of the page. The logic is fairly straight forward : when the form is being filled out listen for when A and B have focus, remember if either is checked or ignored and check to make sure both are not simultaneously filled out. Check this on submit as well. Good luck, DED On Sun, Oct 11, 2009 at 7:42 AM, Phper hi.steven...@gmail.com wrote: How can I write the code in the context of Jquery validate function? On Oct 11, 12:43 pm, Don Dunbar salemd1s...@gmail.com wrote: Hi, javascript has an 'xor' operator. It works just like 'or' in an 'if' statement except in 'xor' only one side can be true. In a normal 'or' statement either side can be true or both can. So you probably want to do something like: if ( A XOR B) { } . Then only one can be true to continue if both are true the statement returns 'false'.Hope this helps. DED On Sat, Oct 10, 2009 at 10:37 PM, Phper hi.steven...@gmail.com wrote: There are two input fields in a form, but only one of them is required, they are not required at the same time. Either A or B is required. ( A is required OR B is required). In other words, a user can input data to field A, or he can input data to filed B, but he can not input data to Both A and B at the same time.
[jQuery] Re: Only one of two fields is required. How to implement this logic in Jquery form validation?
No, I can not use radio. At the help of a veteran programmer, I was able to write the following code and it works. script type=text/javascript src=http://code.jquery.com/jquery- latest.js/script script type=text/javascript src=http://dev.jquery.com/view/trunk/ plugins/validate/jquery.validate.js/script script type=text/javascript !-- $(document).ready(function() { $(#form1).validate({ rules: { participations: { required: function() { return $('#days').val() == '' ? true : false; } }, days: { required: function() { return $('#participations').val() =='' ? true: false; } }, title: { required: true, minlength:40 } , content: { required: true, minlength:100, maxlength:600 }, evaluation: { required: true, minlength:50, maxlength:300 }, price: { required: true, digits:true }, multi:{ required:true } }, messages: { } }); }); -- /script There is a minor problem. I wanna change the default position of an alert message which is This field is required. by default. How to do it? On Oct 12, 2:54 pm, Don Dunbar salemd1s...@gmail.com wrote: I thought of a much simpler solution. If possible could you use radio buttons for those two choices in your HTML? In a radio button group selecting one automatically deselects other buttons in the group. Then you could just use one of the built in validation checks, as you already have done, to make sure one is checked.DED On Mon, Oct 12, 2009 at 1:43 AM, Phper hi.steven...@gmail.com wrote: I am not familiar with the syntax of Jquery plugin. On Oct 12, 2:19 pm, Don Dunbar salemd1s...@gmail.com wrote: Hi , I double checked on javascript's XOR operator and it only works with bitwise: so you will have to write your own XOR . This isn't hard : [code] if (!foo != !bar) [\code] should work for all elements. or this [code]if( ( foo !bar ) || ( !foo bar ) )[\code] For the validator method I haven't actually tried to run this but you can try this:[code] $.validator.addMethod( onlyCheckOne, function(value, elements) { // but put whatever you're using to see if either is checked in the next line return this.optional(value) || elements[o]:checked XOR elements[1]:checked; }, Please check either participations or days, but not both )[/code] note change XOR to whatever method you decide to use. Then add the check to your rules. DED On Mon, Oct 12, 2009 at 12:36 AM, Phper hi.steven...@gmail.com wrote: script type=text/javascript src=http://code.jquery.com/jquery- latest.js/script script type=text/javascript src=http://dev.jquery.com/view/trunk/ plugins/validate/jquery.validate.js/script script type=text/javascript !-- $(document).ready(function() { $(#form1).validate({ rules: { title: { required: true, minlength:40 } , content: { required: true, minlength:100, maxlength:600 }, evaluation: { required: true, minlength:50, maxlength:300 }, price: { required: true, digits:true }, multi:{ required:true } }, messages: { } }); }); -- /script As you can see from the code above, title, content, evaluation, prices and multi are required. All of them are required. But there are additional two fields, which are participations and days. Only one of them is required. Either participations or days is required. How to write this code? On Oct 12, 10:17 am, Phper hi.steven...@gmail.com wrote: A good clue. But I still don't know where to write the if statement. It would be good if you can give me an example. On Oct 11, 10:57 pm, Don Dunbar salemd1s...@gmail.com wrote: Hi, if you are using the validation plugin, I believe it has a function addMethod that allows you to write your own method for the validation. It requires a name (javascript identifier), a method to check input against ( in your case A and B would be checked for completion) and a message to display when there is an error (i.e. neither A nor B is filled out, or both are). You can get the details for using the addMethod function at the jQuery Docs
[jQuery] Re: Only one of two fields is required. How to implement this logic in Jquery form validation?
If you're using the Metadata plugin and inline rules: input type=text id=a class={validate:{required:'#b:blank'}} / input type=text id=b class={validate:{required:'#a:blank'}} / I've not actually tested it but it should work. On Oct 11, 4:37 am, Phper hi.steven...@gmail.com wrote: There are two input fields in a form, but only one of them is required, they are not required at the same time. Either A or B is required. ( A is required OR B is required). In other words, a user can input data to field A, or he can input data to filed B, but he can not input data to Both A and B at the same time. How to implement this constraint in Jquery form validation?
[jQuery] Re: Only one of two fields is required. How to implement this logic in Jquery form validation?
How to change the default position of an error message in Jquey form validation plugin? On Oct 12, 4:33 pm, Gordon grj.mc...@googlemail.com wrote: If you're using the Metadata plugin and inline rules: input type=text id=a class={validate:{required:'#b:blank'}} / input type=text id=b class={validate:{required:'#a:blank'}} / I've not actually tested it but it should work. On Oct 11, 4:37 am, Phper hi.steven...@gmail.com wrote: There are two input fields in a form, but only one of them is required, they are not required at the same time. Either A or B is required. ( A is required OR B is required). In other words, a user can input data to field A, or he can input data to filed B, but he can not input data to Both A and B at the same time. How to implement this constraint in Jquery form validation?
[jQuery] Re: Only one of two fields is required. How to implement this logic in Jquery form validation?
Also, how to prevent a user filling out both fields? On Oct 12, 4:48 pm, Phper hi.steven...@gmail.com wrote: How to change the default position of an error message in Jquey form validation plugin? On Oct 12, 4:33 pm, Gordon grj.mc...@googlemail.com wrote: If you're using the Metadata plugin and inline rules: input type=text id=a class={validate:{required:'#b:blank'}} / input type=text id=b class={validate:{required:'#a:blank'}} / I've not actually tested it but it should work. On Oct 11, 4:37 am, Phper hi.steven...@gmail.com wrote: There are two input fields in a form, but only one of them is required, they are not required at the same time. Either A or B is required. ( A is required OR B is required). In other words, a user can input data to field A, or he can input data to filed B, but he can not input data to Both A and B at the same time. How to implement this constraint in Jquery form validation?
[jQuery] Re: Only one of two fields is required. How to implement this logic in Jquery form validation?
Also, how to prevent a user filling out both fields? On Oct 12, 4:48 pm, Phper hi.steven...@gmail.com wrote: How to change the default position of an error message in Jquey form validation plugin? On Oct 12, 4:33 pm, Gordon grj.mc...@googlemail.com wrote: If you're using the Metadata plugin and inline rules: input type=text id=a class={validate:{required:'#b:blank'}} / input type=text id=b class={validate:{required:'#a:blank'}} / I've not actually tested it but it should work. On Oct 11, 4:37 am, Phper hi.steven...@gmail.com wrote: There are two input fields in a form, but only one of them is required, they are not required at the same time. Either A or B is required. ( A is required OR B is required). In other words, a user can input data to field A, or he can input data to filed B, but he can not input data to Both A and B at the same time. How to implement this constraint in Jquery form validation?
[jQuery] Re: Hide checkbox when choosen value in select 0
Thanks Brian. It's very work. On Oct 11, 10:55 pm, brian bally.z...@gmail.com wrote: On Sat, Oct 10, 2009 at 1:45 PM, Tan it_qn2...@yahoo.com wrote: Hello, span id=thmr_5 class=thmr_call div class=form-item id=edit-sitewide-wrapper label class=option for=edit-sitewideinput type=checkbox name=sitewide id=edit-sitewide value=1 class=form-checkbox / site wide/label /div /span span id=thmr_7 class=thmr_call div class=form-item id=edit-termwide-wrapper label for=edit-termwideChoosen get termwide: /label select name=termwide class=form-select id=edit-termwide option value=0 selected=selectedNo choosen/optionoption value=256Term1/optionoption value=257Term2/option/select /div /span I have code jquery when i choosen select options value 0 then disable checkbox : $('#edit-termwide').click(function() { if ($(#edit-termwide option:selected).length 0) { $('#edit-sidewide').attr('disabled', true); } else { $('#edit-sidewide').attr('disabled', false); } }); but it's not work please help me! First, you have a typo: id=edit-sitewide '#edit-sidewide' And you should use change(), not click(). Here are a couple of different ways to handle it: $(function() { $('#edit-termwide').change(function() { $('#edit-sitewide').attr( 'disabled', parseInt($(#edit-termwide option:selected).val()) 0 ? 'disabled' : '' ); }); }); $(function() { $('#edit-termwide').change(function() { if (parseInt($('#edit-termwide option:selected').val()) 0) { $('#edit-sitewide').attr('disabled', 'disabled'); } else { $('#edit-sitewide').removeAttr('disabled'); } }); });
[jQuery] Re: $.post() speed
Yeap, thanks fof the helping out!! I still may have some more questions and if so, i ll post some more! Kind regards, On Oct 9, 5:43 pm, MorningZ morni...@gmail.com wrote: You've got the x set inside the callback and are trying to alert it *before* it gets back from it the $.postcall, hence it's empty so if you have $.post( ... do ajax stuff to variable x . ) alert(x); // --- this gets run right away, the asynchronous call of $.post doesn't wait to finish before going to the next line so another way of looking at it: var foo = 1; $.post( some ajax call that takes 2 seconds to set foo to 99 ); alert(foo); that is going to alert 1 each and every time, because JavaScript isn't going to wait before doing the alert does that help? On Oct 9, 12:18 pm, Adonis achrysoch...@hotmail.com wrote: ok, here is an effort to sum up the code.. * function initialiseLegendLayerGroupEntry(a,b,c,d,e,f) { var x; $(#division_name).bind(click, function() { if(this.value == sth) { y=callFunction(a,b,c,d,e,f); $.ajax({ type: POST, url: /serverFunction/, data: {project_name:d,layer_name:e,group_name:f}, success: function(msg){ $(#an entry point for html files that are served).after(msg); alert( $(#division where the wanted value is stored).val() ); // this alert window pops up at the end. x= $(#division where the wanted value is stored).val(); } }); alert(x); // this pop up window is always empty. it opens while i still receive print commands from my server script ! } }); } I think this code is a good example of my problem. Can you identify an error somewhere? thanks, On Oct 8, 6:07 pm, MorningZ morni...@gmail.com wrote: You should should the specific $.post() code in detail, there's something you are missing because when you get back from the async call, everything (global variables, page objects) are fully available at that point... there's zero need to use setTimeout On Oct 8, 12:27 pm, Adonis achrysoch...@hotmail.com wrote: Dan, I used a $.ajax() call with a callback - success: function(msg) etc. but still it does not work the way I want to. from the server side i am using, * return render_to_response(blah.html,{ 'project_id':project_id }, context_instance = RequestContext(request)) * putting the project_id in a divinput id=klain value=project_id / /div and if the ajax call is successfull i do this, * alert( $(#klain).val() ); * The alert window does pop up, but after the rest of the functions in the code have been read. I somehow need to delay the javascript parsing, until the input of the division in the html that is rendered gets the project_id value. This is why i am looking into setTimeOut () js function. cheers, On Oct 8, 2:08 pm, Dan G. Switzer, II dswit...@pengoworks.com wrote: Adonis, The $.post() function is asynchronous (by default) when your code hits a $.post() call, it'll keep executing code. In order to do something with the results of your AJAX call, you'll want to use the callback option--which is a function run when the AJAX call is completed. -Dan On Thu, Oct 8, 2009 at 7:14 AM, Adonis achrysoch...@hotmail.com wrote: I am not entirely sure if i am using proper definitions here, but here it goes.. I have $.post() inside javascript functions. If ajax is successfull, it returns data from the server. I am trying to assign this data to javascript global variables. The problem is that my global javascript variables end up to be empty. It seems it takes time for the ajax to return the data and by the time the server data is returned, the browser has comploted reading through the rest of the javascript functions. Thus, leaving my global variables empty. Do you have any suggestions on how this could be fixed? I am trying setTimeOut() at the moment but i would be glad to concider other solutions as well.. I could provide code examples on request. Thanks in advance!- Hide quoted text - - Show quoted text -
[jQuery] [form] stop success message return if validation fails on server side
Hi all, I am making a call to a php file which right at this minute has no validation, all validation is been done by the jquery form plugin. I post to the thanks file but if the validation (xss prevention soon to be implemented) in the thanks fails I want to stop the processing of the form i.e. stop the return of success. How do I do this, any insight appreciated. Code: $(#myform).validate({ submitHandler: function(myform) { jQuery(myform).ajaxSubmit({ type: POST, url: thanks.php, success: function() { $('#contact_form').html(div id='message'/div); $('#message').html(h2Contact Form Submitted!/h2) .append(pWe will be in touch soon./p) .hide() .fadeIn(1500, function() { $('#message').append(img id='checkmark' src='/ images/check.png' /); }); } }); }
[jQuery] AutoHeight IFrame
Hello, i want to make a iframe page that loading a page from other site. I have try jQuery iFrame Sizing to set auto height in iframe... but it is failed. What's the problem...? This is my code : - on Head script type=text/javascript src=js/jquery.js/script script type=text/javascript src=js/iframe.js/script on Body iframe scrolling=no frameborder=0 width=1025 src=http:// www.apexdyna.com/eng/company.asp//iframe - thanks
[jQuery] the implementation of jQuery.boxModel
in jq-1.2.5, jQuery.boxModel = !jQuery.browser.msie || document.compatMode == CSS1Compat but in jq-1.3.2, jQuery(function(){ var div = document.createElement(div); div.style.width = div.style.paddingLeft = 1px; document.body.appendChild( div ); jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; document.body.removeChild( div ).style.display = 'none'; }); I wanna know why the implementation of jQuery.boxModel changed?
[jQuery] Changing a text in a div
I am very very new to Jquery, being more of a designer than a programmer. I have a fairly (I believe) simple issue, that I'm hoping you will be able to assist with. I have a div class called child-pages, that calls up some text in h2 tags, which says Children Pages. I am wanting to use a simple Jquery script to change Children Pages to Sub-pages. How do I go about implementing a script that will make this change? Many thanks!
[jQuery] jQuery Documentation for Visual Studio
Hi, I have VS Express 2008 SP1 and Patch VS90SP1-KB958502-x86 installed. I can't get VS Intellisense to work for , jQuert 1.3.2. When i ex. type $, I get this: The object is not compatible with this property or method @ 2139:1 If I change to jQuery 1.2.6 it works well? Any suggestions to what I can do to get jQuery 1.3.2 up and run with VS Doc? Thanks, Paul
[jQuery] no filenames list in multi-upload control
Hello, I wrote: html lang=pl head ... script src=jquery-latest.js type=text/javascript language=javascript/script script src=jquery.MultiFile.js type=text/javascript language=javascript/script script src=jquery.form.js type=text/javascript language=javascript/script script src=jquery.js type=text/javascript language=javascript/script script src=jquery.blockUI.js type=text/javascript language=javascript/script script src=jquery.MetaData.js type=text/javascript language=javascript/script /head body ... input type=file class=multi accept=gif|jpg|jpeg|jpe|bmp| png|mpg|mpeg|mov|avi|wmv ... The result is that on page index.php I have a single control type=file but I can choose only one file - there's no list of file names below the control. Please help. Thanks in advance.
[jQuery] Re: jQuery/JSON forms issue: tries to download response
On Oct 10, 9:16 am, Jim stapleton...@gmail.com wrote: On Oct 9, 8:50 pm, MorningZ morni...@gmail.com wrote: it's supposed to be application/json, not text/json. set the content type properly in your server side code and you'll be fine... text/plain will work as well After some further searching, I found this section of code in the jQuery library. If I modify the accepts:{... json: ...} line to: 'json: application/json, text/javascript,text/json,' that should work as well, right? (Sorry, won't actually get to test it until Monday, and was hoping to get some idea of the feasibility of the route before then). jQuery.extend({ //... ajaxSettings: { //... accepts: { xml: application/xml, text/xml, html: text/html, script: text/javascript, application/javascript, json: application/json, text/javascript, text: text/plain, _default: */* } }, This change failed to remedy the problem. -Jim Stapleton
[jQuery] Re: Changing a text in a div
You'd probably want to use the text() or html() method for this. Assuming the h2 tags in question are inside the child-pages div, your code would be something like this: $(function(){ $('.child-pages h2').text(Sub-pages); }); On Oct 12, 9:56 am, Fynci fyncimy...@gmail.com wrote: I am very very new to Jquery, being more of a designer than a programmer. I have a fairly (I believe) simple issue, that I'm hoping you will be able to assist with. I have a div class called child-pages, that calls up some text in h2 tags, which says Children Pages. I am wanting to use a simple Jquery script to change Children Pages to Sub-pages. How do I go about implementing a script that will make this change? Many thanks!
[jQuery] Re: the implementation of jQuery.boxModel
I wanna know why the implementation of jQuery.boxModel changed? Most likely because it was using browser detection via the userAgent, which is not reliable. If it's causing trouble, make a post in the jQuery-dev group with an example.
[jQuery] How to Sort an Unordered List - TinySort
Hi, I have the following DOM structure (unordered list), that I would like to sort on the a href tag name using jQuery – specifically the TinySort plug-in http://plugins.jquery.com/project/TinySort Structure is as follows: div id=refmenu ul id=list lia title=Google href=Google/a/li lia title=Apple href=Apple/a/li lia title=IBM href=IBM/a/li lia title=Yahoo! href=Yahoo!/a/li lia title=Hotmail href=Hotmail/a/li /ul /div I have tried the following but to no avail, i.e.: $(div#refmenuul#listli).tsort(a[title],{orderby:title}); Based on this, I am obviously trying to sort on the title attribute. Any help would be great. Other questions, do I need to make this call within the document.ready () or can I just perform this call within a normal javascript function? Thanks.
[jQuery] Re: jQuery/JSON forms issue: tries to download response
This change failed to remedy the problem As it shouldn't... because the bottom line is: the browser makes the request and the browser receives the request, and when the browser sees text/json come back from the server, it has no idea what to do with it so it prompts to download the file this needs to be fixed on the server side, either the calling page needs to set the proper/correct MIME type, ** or ** you can write your own server side code (with the proper MIME type) that in turn calls the bad one, kind of like a proxy... that way your jQuery will work without needing the original page changed On Oct 12, 8:36 am, Jim stapleton...@gmail.com wrote: On Oct 10, 9:16 am, Jim stapleton...@gmail.com wrote: On Oct 9, 8:50 pm, MorningZ morni...@gmail.com wrote: it's supposed to be application/json, not text/json. set the content type properly in your server side code and you'll be fine... text/plain will work as well After some further searching, I found this section of code in the jQuery library. If I modify the accepts:{... json: ...} line to: 'json: application/json, text/javascript,text/json,' that should work as well, right? (Sorry, won't actually get to test it until Monday, and was hoping to get some idea of the feasibility of the route before then). jQuery.extend({ //... ajaxSettings: { //... accepts: { xml: application/xml, text/xml, html: text/html, script: text/javascript, application/javascript, json: application/json, text/javascript, text: text/plain, _default: */* } }, This change failed to remedy the problem. -Jim Stapleton
[jQuery] Re: jQuery Documentation for Visual Studio
The error you're getting is caused by an @ symbol in one or more your attribute selectors. This syntax was removed in jQuery 1.3.x. Just remove the @ from the selector(s) and you should be fine. For example, change $('a...@href=somthing.html]') to $ ('a[href=somthing.html]') . For more information about getting Intellisense working with Visual Studio, see this article: http://www.learningjquery.com/2009/07/setting-up-visual-studio-intellisense-for-jquery --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Oct 11, 2009, at 11:58 PM, Paul wrote: Hi, I have VS Express 2008 SP1 and Patch VS90SP1-KB958502-x86 installed. I can't get VS Intellisense to work for , jQuert 1.3.2. When i ex. type $, I get this: The object is not compatible with this property or method @ 2139:1 If I change to jQuery 1.2.6 it works well? Any suggestions to what I can do to get jQuery 1.3.2 up and run with VS Doc? Thanks, Paul
[jQuery] Re: using jquery ui plugin to make carousel effect
If you view the html of that demo, one of the files included is ui.carousel.js : http://jquery-ui.googlecode.com/svn/branches/labs/carousel/ui.carousel.js http://jquery-ui.googlecode.com/svn/branches/labs/carousel/ui.carousel.jsIf you include that in addition to jQuery and jQuery UI (or at least ui.core.js, as the example does) you should be fine. Example: jQuery UI Labs Carousel demo: http://jsbin.com/aliqu jQuery UI Labs Carousel demo source: http://jsbin.com/aliqu/edit If you have any further question about this or any other jQuery UI plugins, labs or otherwise, please note there's a dedicated list for jQuery UI help: http://groups.google.com/group/jquery-ui - Richard On Sat, Oct 10, 2009 at 6:18 PM, Aaron shyhockey...@aol.com wrote: Hi, I am trying to use this plugin:http://jquery-ui.googlecode.com/svn/ branches/labs/carousel/demo/index.html I don't know what the function name to use to make a carousel effect. I even looked at the source code of those demos and tried to use the function carousel. I have firefox debugger installed and it spits our one error saying that carousel isn't a function. I would like to know what the name of the function that I should be using to create the carousel effect. I have asked on jquery irc and one person said he can help me out only if I am willing to pay him some . I refused and decided to post it on here. He flat out did told me that I am using the wrong function name yet it's the same function that I see used in the demos.
[jQuery] Re: Jcarousel Add Link
add links to your item list something like: {url: http://static.flickr.com/66/199481236_dc98b5abb3_s.jpg;, title: Flower1, link:http://wherever.com/}, and then update the helper function to something like: function mycarousel_getItemHTML(item) { return 'a href='+item.link+'img src=' + item.url + ' width=75 height=75 alt=' + item.url + ' //a'; }; Jon 2009/10/9 cMantilla cmantill...@gmail.com I would like to use the carousel at http://sorgalla.com/projects/jcarousel/examples/dynamic_javascript.html My company needs a product slider and it works well with a few changes to the CSS. I am having trouble however adding links to the images. If someone could show me a function or how to declare a href's in this code, it would be greatly appreciated. Mantilla
[jQuery] Re: jQuery Documentation for Visual Studio
Paul, you'll also find that a good amount of plugins also stop Intellisense from working, using -vsdoc.js on a blank copy of the plugin gets around that Great blog post with tons of tips and tricks on jQuery + Studio: http://blogs.msdn.com/webdevtools/archive/2008/11/18/jscript-intellisense-faq.aspx On Oct 12, 9:05 am, Karl Swedberg k...@englishrules.com wrote: The error you're getting is caused by an @ symbol in one or more your attribute selectors. This syntax was removed in jQuery 1.3.x. Just remove the @ from the selector(s) and you should be fine. For example, change $('a...@href=somthing.html]') to $ ('a[href=somthing.html]') . For more information about getting Intellisense working with Visual Studio, see this article: http://www.learningjquery.com/2009/07/setting-up-visual-studio-intell... --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com On Oct 11, 2009, at 11:58 PM, Paul wrote: Hi, I have VS Express 2008 SP1 and Patch VS90SP1-KB958502-x86 installed. I can't get VS Intellisense to work for , jQuert 1.3.2. When i ex. type $, I get this: The object is not compatible with this property or method @ 2139:1 If I change to jQuery 1.2.6 it works well? Any suggestions to what I can do to get jQuery 1.3.2 up and run with VS Doc? Thanks, Paul
[jQuery] Re: jQuery Documentation for Visual Studio
Try to use instead of the $ operator jQuery. for example: instead of $(document).ready(); write jQuery(document).ready(); Gk___ 2009/10/12 Paul rcmdk...@gmail.com: Hi, I have VS Express 2008 SP1 and Patch VS90SP1-KB958502-x86 installed. I can't get VS Intellisense to work for , jQuert 1.3.2. When i ex. type $, I get this: The object is not compatible with this property or method @ 2139:1 If I change to jQuery 1.2.6 it works well? Any suggestions to what I can do to get jQuery 1.3.2 up and run with VS Doc? Thanks, Paul
[jQuery] Re: no filenames list in multi-upload control
Scripts script src=jquery-latest.js type=text/javascript language=javascript/script and script src=jquery.js type=text/javascript language=javascript/script is same. They may conflict with each other, look at the JavaScript console in your browser. Gk___ 2009/10/12 Jivanmukta jivanmu...@poczta.onet.pl: script src=jquery-latest.js type=text/javascript language=javascript/script
[jQuery] Re: jQuery Documentation for Visual Studio
the $ works perfectly fine in Studio, there's zero need to use jQuery unless something is included that needs the dollar sign instead On Oct 12, 10:25 am, Evgeny Bobovik bobo...@gmail.com wrote: Try to use instead of the $ operator jQuery. for example: instead of $(document).ready(); write jQuery(document).ready(); Gk___ 2009/10/12 Paul rcmdk...@gmail.com: Hi, I have VS Express 2008 SP1 and Patch VS90SP1-KB958502-x86 installed. I can't get VS Intellisense to work for , jQuert 1.3.2. When i ex. type $, I get this: The object is not compatible with this property or method @ 2139:1 If I change to jQuery 1.2.6 it works well? Any suggestions to what I can do to get jQuery 1.3.2 up and run with VS Doc? Thanks, Paul
[jQuery] Re: [form] stop success message return if validation fails on server side
Try to rewrite thanks.php so that it returns the data you need in case of success, and in case of error: ie judging from your code, in case of success of thanks.php should return the following data: div id=message style=display: none; h2Contact Form Submitted!/h2 pWe will be in touch soon./p img id='checkmark' src='/images/check.png'/ /div and your jQuery code: $(#myform).validate({ submitHandler: function(myform) { jQuery(myform).ajaxSubmit({ type: POST, url: thanks.php, success: function(data) { $('#contact_form').html(data); $('#contact_form').fadeIn(1500); }); } }); } Gk___ 2009/10/12 HairyJim james.d...@gmail.com: Hi all, I am making a call to a php file which right at this minute has no validation, all validation is been done by the jquery form plugin. I post to the thanks file but if the validation (xss prevention soon to be implemented) in the thanks fails I want to stop the processing of the form i.e. stop the return of success. How do I do this, any insight appreciated. Code: $(#myform).validate({ submitHandler: function(myform) { jQuery(myform).ajaxSubmit({ type: POST, url: thanks.php, success: function() { $('#contact_form').html(div id='message'/div); $('#message').html(h2Contact Form Submitted!/h2) .append(pWe will be in touch soon./p) .hide() .fadeIn(1500, function() { $('#message').append(img id='checkmark' src='/ images/check.png' /); }); } }); }
[jQuery] Re: Newbie trying to Ajax in IE8
I would recommend you create somewhere on the main HTML page hidden field (example: div id=hidden-field style=display: none; / div) and after receiving data using ajax immediately put them in. this element, and all subsequent processing is performed on the data already located in this field. Upon completion of processing, this field can clean: $ ( '# hidden-field'). Html (''); so I usually do and no problem happens with any browser:) Gk___ 2009/10/11 rhernan...@vtr.net: hello, im newb in jquery ajax. im trying to make this code work in IE8 and i dont know what im doing wrong. is a simple call with $.ajax to get a word from a php Works fine in Firefox and Chrome, but in IE8 seems like .find wont find the word tag. i been looking at the discussion mails but cant find an answer, i hope someone can help me. thanks. pd : sorry for my bad english. =D test.html -- htmlhead meta http-equiv=Content-Type content=text/html;charset=ISO-8859-1 script type=text/javascript src=jquery-1.3.2.min.js/script script type=text/javascript function test() { $.ajax({type:GET,url:test.php, success: function(xml) { alert(xml); // just to check im getting the xml text $(xml).find('word').each(function(){ alert(test 1 - the word is : +$(this).text()); }); alert(test 2 - the word is : +$(word, xml).text()); } }); } /script title/title /head body input type=button onClick=test() value=GO /body /html test.php - ?php header('Content-type: text/xml'); $xml = ?xml version='1.0' encoding='ISO-8859-1'\n; $xml .= answer; $xml .= wordhello/word; $xml .= /answer; echo $xml; ?
[jQuery] Low Pro instance talking to each other
Hey all, I'm pretty new to Low Pro for jQuery and trying to get things right first time around http://www.danwebb.net/2008/1/31/low-pro-for-jquery I am trying to get multiple instances of low pro behaviors to fire custom events in other low pro behavior / instances. I do have a solution that seems to work ok for now, However I wonder if anyone has a better solution as what I've got seems like it could be a little more elegant. Here's my example ... script type=text/javascript $(document).ready(function(){ $('#left').attach(LEFT); $('#right').attach(RIGHT, LEFT); }); /script pclick me i am the a href=# id=leftLEFT event/a/p pclick me i am the a href=# id=rightRIGHT event/a/p using the following low pro var LEFT = $.klass({ initialize: function() {}, onclick: function(el) { }, onTwoleftfeet: function() { alert('...but i have 2 left feet.'); } }); var RIGHT = $.klass({ initialize: function(otherBehavior) { this.interactionInstance = otherBehavior.instances[0]; }, onclick: function(el) { alert('First with the right.'); this.interactionInstance.onTwoleftfeet(); return false; }, }); So it's passing the (already initialised) LEFT behavior into the RIGHT which then has access to its internal instances array. Obviously we could scale this by passing in arrays of behaviors, and looping through instances, but I am questioning the approach in general. For example the ordering of the attach calls is critical, and I sort of feel there is a lot of work to do to find a partner instance. Feedback is always appreciated
[jQuery] Re: Display fails when jQuery.js isn’t ca ched. When cached, page displayed OK.
Bob, Working on quite a bit of jQuery AJAX over the past week or so, I've noticed similar side-effects. I have no idea if my issues are related to yours, but 90% of my problems were solved by using the callbacks instead of expecting that linear execution would be fine with the few things I was trying to call. Since I've stopped trying to do anything but AJAX calls where I do them (and started using other callbacks for things like .animate and the like), I've had nothing but clean loading pages. Again, I doubt the issues are related, but the symptom is at least identical. ;) - Lance On Oct 11, 9:42 pm, Bob baconeater...@gmail.com wrote: I have jQuery UI Tabs which load their content via AJAX. About once every 15 times when the entire page is loaded (not just XHR), things fail and I don't see the proper content in the tab. The jQuery executes without error, but the page display is wrong. Fiddler showed me that when things fail I also see that jQuery.js and jQuery-ui.js are both sent to the browser in full (~100kB). Normally, a page load results in HTTP status code 304 for both of those files, they're not re-downloaded, and the page displays properly. When the status code is 200 and fresh copies of jQuery/UI are sent, things fail. I notice this most often in IE8, but that's because I use it for web development. I have seen it in Firefox, but for some reason I can't reproduce it now. Fiddler shows that the HTTP request asks for: GET /Scripts/jquery-1.3.2.min.js?_=1255309685187 HTTP/1.1 I can't figure out what the ?_=1255309685187 is for, but I'm guessing it's a token to indicate for how long the file should be cached. Since I can't reproduce the problem in Firefox right now, I don't know what Firebug says. Any insight would be appreciated.
[jQuery] jQuery Star Rating Plugin v3.12
Hey guys, i want to get rid of the cancel rating button that appears next to the 5 stars when enabled. I need to force the users to enter a rating, so i need to take the cancel rating button off (makes value = 0). I can't find how to change this! please help thanks
[jQuery] (tooltip) Markup problem
Hello, I have been using Bassistance tooltip but I think the markup is really incorrect. http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ Why forcing an H3 into the tooltip? Did you ever checked a page with it in Opera's table of contents? By imposing H3 you are breaking the semantics of a page ... At least you could allow to have an option to have the H3 or not ... What do you think? Thanks, Miguel
[jQuery] Re: Only one of two fields is required. How to implement this logic in Jquery form validation?
It will be confusing for someone filling out your form if you leave both fields available at the same time, instead... when the user enters text into one of the fields why don't you run an onChange or onKeyPress check to see if they've entered something and if so, disable/hide the other field .attr('disabled', disabled') or .hide() or if they have deleted what's in the field to enable/hide the partner field again... just remember to include null checks to unset the disabling/hiding On Oct 12, 3:55 am, Phper hi.steven...@gmail.com wrote: Also, how to prevent a user filling out both fields? On Oct 12, 4:48 pm, Phper hi.steven...@gmail.com wrote: How to change the default position of an error message in Jquey form validation plugin? On Oct 12, 4:33 pm, Gordon grj.mc...@googlemail.com wrote: If you're using the Metadata plugin and inline rules: input type=text id=a class={validate:{required:'#b:blank'}} / input type=text id=b class={validate:{required:'#a:blank'}} / I've not actually tested it but it should work. On Oct 11, 4:37 am, Phper hi.steven...@gmail.com wrote: There are two input fields in a form, but only one of them is required, they are not required at the same time. Either A or B is required. ( A is required OR B is required). In other words, a user can input data to field A, or he can input data to filed B, but he can not input data to Both A and B at the same time. How to implement this constraint in Jquery form validation?
[jQuery] Clean code. Could someone, please, help me out?
Hello, I am using Bassistance tooltip but I need to simplify the markup. So instead of using: helper.parent = $('div id=' + settings.id + 'h3/h3div class=body/divdiv class=url/div/div') I would like to use: helper.parent = $('div id=' + settings.id + 'span/span/div') However, when I did this change everything stopped working. I think I need to clean some extra code but all my tries didn't solve the problem ... Could someone help me out with this? Here is the plugin original code: ;(function($) { // the tooltip element var helper = {}, // the current tooltipped element current, // the title of the current element, used for restoring title, // timeout id for delayed tooltips tID, // IE 5.5 or 6 IE = $.browser.msie /MSIE\s(5\.5|6\.)/.test(navigator.userAgent), // flag for mouse tracking track = false; $.tooltip = { blocked: false, defaults: { delay: 200, fade: false, showURL: true, extraClass: , top: 15, left: 15, id: tooltip }, block: function() { $.tooltip.blocked = !$.tooltip.blocked; } }; $.fn.extend({ tooltip: function(settings) { settings = $.extend({}, $.tooltip.defaults, settings); createHelper(settings); return this.each(function() { $.data(this, tooltip, settings); this.tOpacity = helper.parent.css(opacity); // copy tooltip into its own expando and remove the title this.tooltipText = this.title; $(this).removeAttr(title); // also remove alt attribute to prevent default tooltip in IE this.alt = ; }) .mouseover(save) .mouseout(hide) .click(hide); }, fixPNG: IE ? function() { return this.each(function () { var image = $(this).css('backgroundImage'); if (image.match(/^url\([']?(.*\.png)[']?\)$/i)) { image = RegExp.$1; $(this).css({ 'backgroundImage': 'none', 'filter': progid:DXImageTransform.Microsoft.AlphaImageLoader (enabled=true, sizingMethod=crop, src=' + image + ') }).each(function () { var position = $(this).css('position'); if (position != 'absolute' position != 'relative') $(this).css('position', 'relative'); }); } }); } : function() { return this; }, unfixPNG: IE ? function() { return this.each(function () { $(this).css({'filter': '', backgroundImage: ''}); }); } : function() { return this; }, hideWhenEmpty: function() { return this.each(function() { $(this)[ $(this).html() ? show : hide ](); }); }, url: function() { return this.attr('href') || this.attr('src'); } }); function createHelper(settings) { // there can be only one tooltip helper if( helper.parent ) return; // create the helper, h3 for title, div for url helper.parent = $('div id=' + settings.id + 'h3/h3div class=body/divdiv class=url/div/div') // add to document .appendTo(document.body) // hide it at first .hide(); // apply bgiframe if available if ( $.fn.bgiframe ) helper.parent.bgiframe(); // save references to title and url elements helper.title = $('h3', helper.parent); helper.body
[jQuery] Re: Autocomplete plugin: results as table?
hello maarten, your attempt sounds interesting. could you give public access to these urls? On Wed, Oct 7, 2009 at 18:08, Maarten maartenwie...@gmail.com wrote: http://autocompleter.mwierda.blackpearl.minus3.nl/demo/table.html type in 'c' for a grouped result, using a TABLE for the layout. its mostly the fillList that's altered, see: http://autocompleter.mwierda.blackpearl.minus3.nl/jquery.autocomplete.js please let me know if this was helpful or if there are any comments. On Oct 6, 10:38 am, Maarten maartenwie...@gmail.com wrote: FYI: I looked into the source of the autocomplete script and I think I'm gonna try to extend it myself. -- alex smime.p7s Description: S/MIME Cryptographic Signature
[jQuery] how to customize 'active menu' color in superfish menu??
How do i adjust the color of the selected menu for the superfish menu? the most i could do was this: .sf-menu a:active { background: red; } but that only changed the menu to red when its clicked on and it'll change back to grey... i can't figure this out. My website (far from complete, and only a test site): http://www.covenantofgrace.exofire.net/
[jQuery] Selecting all last cells in all rows?
with this html: table tbody tr td.../tdtd.../tdtd.../td /tr tr td.../tdtd.../tdtd.../td /tr tr td.../tdtd.../tdtd.../td /tr /tbody /table what would the selector be to get all the *last* td's in each row ? I'm looping through the rows, and then getting the last td in each row and doing what I need to do, but I recall an earlier topic where it was a single selector to get all those last cells in one shot... damned if i can find it though... i do believe :last-child was involved Thanks in advance
[jQuery] Re: Selecting all last cells in all rows?
$('td:last-child') On Oct 12, 9:45 am, MorningZ morni...@gmail.com wrote: with this html: table tbody tr td.../tdtd.../tdtd.../td /tr tr td.../tdtd.../tdtd.../td /tr tr td.../tdtd.../tdtd.../td /tr /tbody /table what would the selector be to get all the *last* td's in each row ? I'm looping through the rows, and then getting the last td in each row and doing what I need to do, but I recall an earlier topic where it was a single selector to get all those last cells in one shot... damned if i can find it though... i do believe :last-child was involved Thanks in advance
[jQuery] Re: Only one of two fields is required. How to implement this logic in Jquery form validation?
Hi, glad you found a solution:to prevent the user from filling out both inputs in the first place. [code]$(#days).change(function(){ $(#participations).attr(disabled,disabled); }); $(#participations).change(function(){ $(#days).attr(disabled,disabled); }); [\code] DED On Mon, Oct 12, 2009 at 3:55 AM, Phper hi.steven...@gmail.com wrote: Also, how to prevent a user filling out both fields? On Oct 12, 4:48 pm, Phper hi.steven...@gmail.com wrote: How to change the default position of an error message in Jquey form validation plugin? On Oct 12, 4:33 pm, Gordon grj.mc...@googlemail.com wrote: If you're using the Metadata plugin and inline rules: input type=text id=a class={validate:{required:'#b:blank'}} / input type=text id=b class={validate:{required:'#a:blank'}} / I've not actually tested it but it should work. On Oct 11, 4:37 am, Phper hi.steven...@gmail.com wrote: There are two input fields in a form, but only one of them is required, they are not required at the same time. Either A or B is required. ( A is required OR B is required). In other words, a user can input data to field A, or he can input data to filed B, but he can not input data to Both A and B at the same time. How to implement this constraint in Jquery form validation?
[jQuery] possible to empty file input in form with .click or .focus ?
My image upload form has a choice of either upload image by entering url or by browsing for a file, I'm trying to empty the file-input input if you focus on the url-input. I've tried bother these events on click/blur but neither seem to work like they would for a checkbox or text input... $('#input_id').empty(); $('#input_id').attr('value', ''); any ideas would be help my head! -- View this message in context: http://www.nabble.com/possible-to-empty-file-input-in-form-with-.click-or-.focus---tp25860408s27240p25860408.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Incorrect selection on mouse click in IE7+
OK. For anyone else who is tearing their hair out over this one... It would appear that the earlier version of this script works fine in relation to the problem above. You can grab v1.1pre here: http://view.jquery.com/trunk/plugins/autocomplete/jquery.autocomplete.js You can link to the demo from here: http://docs.jquery.com/UI/Autocomplete#Demos Clarification of the problem === Try the Multiple Cities (local): in IE and it works just fine: (v1.1pre) http://view.jquery.com/trunk/plugins/autocomplete/demo/ Try the Multiple Cities (local): in IE and it does not work (v.1.1): http://jquery.bassistance.de/autocomplete/demo/ It does seem to be related to the Selection function when triggered via a mouse click rather than via 'Enter'. If the author could get the multiple feature working as it did in v1.1pre in the most recent v1.1 version it would be excellent! There are also far too many versions of autocomplete flying around in cyberspace. Thanks in advance authors. Rye
[jQuery] Re: possible to empty file input in form with .click or .focus ?
Try: $('#input_id').focus(function(){ $(this).attr(value,); }); On Oct 12, 5:59 pm, captaincarp harry.wi...@gmail.com wrote: My image upload form has a choice of either upload image by entering url or by browsing for a file, I'm trying to empty the file-input input if you focus on the url-input. I've tried bother these events on click/blur but neither seem to work like they would for a checkbox or text input... $('#input_id').empty(); $('#input_id').attr('value', ''); any ideas would be help my head! -- View this message in context:http://www.nabble.com/possible-to-empty-file-input-in-form-with-.clic... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: possible to empty file input in form with .click or .focus ?
Yeah this is what I've been trying, i think maybe different rules apply for file inputs perhaps? amuhlou wrote: Try: $('#input_id').focus(function(){ $(this).attr(value,); }); On Oct 12, 5:59 pm, captaincarp harry.wi...@gmail.com wrote: My image upload form has a choice of either upload image by entering url or by browsing for a file, I'm trying to empty the file-input input if you focus on the url-input. I've tried bother these events on click/blur but neither seem to work like they would for a checkbox or text input... $('#input_id').empty(); $('#input_id').attr('value', ''); any ideas would be help my head! -- View this message in context:http://www.nabble.com/possible-to-empty-file-input-in-form-with-.clic... Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/possible-to-empty-file-input-in-form-with-.click-or-.focus---tp25860408s27240p25861082.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: possible to empty file input in form with .click or .focus ?
hmm yeah, I did a quick google search and it appears that allowing you to access a file input's value attribute would pose a security issue. I found a solution but the code isn't exactly pretty http://gusiev.com/2009/04/clear-upload-file-input-field/ On Oct 12, 6:43 pm, captaincarp harry.wi...@gmail.com wrote: Yeah this is what I've been trying, i think maybe different rules apply for file inputs perhaps? amuhlou wrote: Try: $('#input_id').focus(function(){ $(this).attr(value,); }); On Oct 12, 5:59 pm, captaincarp harry.wi...@gmail.com wrote: My image upload form has a choice of either upload image by entering url or by browsing for a file, I'm trying to empty the file-input input if you focus on the url-input. I've tried bother these events on click/blur but neither seem to work like they would for a checkbox or text input... $('#input_id').empty(); $('#input_id').attr('value', ''); any ideas would be help my head! -- View this message in context:http://www.nabble.com/possible-to-empty-file-input-in-form-with-.clic... Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- View this message in context:http://www.nabble.com/possible-to-empty-file-input-in-form-with-.clic... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: possible to empty file input in form with .click or .focus ?
You could replace the file input when the URL field is focused: $('#fu').replaceWith('input id=fu type=file /'); where #fu is the file input. On Oct 12, 11:53 am, amuhlou amysch...@gmail.com wrote: hmm yeah, I did a quick google search and it appears that allowing you to access a file input's value attribute would pose a security issue. I found a solution but the code isn't exactly prettyhttp://gusiev.com/2009/04/clear-upload-file-input-field/ On Oct 12, 6:43 pm, captaincarp harry.wi...@gmail.com wrote: Yeah this is what I've been trying, i think maybe different rules apply for file inputs perhaps? amuhlou wrote: Try: $('#input_id').focus(function(){ $(this).attr(value,); }); On Oct 12, 5:59 pm, captaincarp harry.wi...@gmail.com wrote: My image upload form has a choice of either upload image by entering url or by browsing for a file, I'm trying to empty the file-input input if you focus on the url-input. I've tried bother these events on click/blur but neither seem to work like they would for a checkbox or text input... $('#input_id').empty(); $('#input_id').attr('value', ''); any ideas would be help my head! -- View this message in context:http://www.nabble.com/possible-to-empty-file-input-in-form-with-.clic... Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- View this message in context:http://www.nabble.com/possible-to-empty-file-input-in-form-with-.clic... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] What causes a query string when requesting jQuery? e.g. /jquery-1.3.2.min.js?_=12553…
I'm troubleshooting a page display glitch involving jQuery AJAX. When the glitch happens, Fiddler shows the following as one of the requests: GET /Scripts/jquery-1.3.2.min.js?_=1255309685187 Normally, the request has no query string and the response status code is 304: GET /Scripts/jquery-1.3.2.min.js However, every so often a query string is appended. Where does this query string come from? What does it mean? I wonder if the AJAX call fails, and then jQuery is refetched with that query string for some reason. The webserver is Visual Studio's Development Server, and I usually see this in IE8. Occasionally I'll see it in Firefox though. The app is ASP.NET MVC.
[jQuery] Re: (tooltip) Markup problem
That sounds like you validate a page for the sake of validation. I think thats beneath the point, therefore I don't get your argument. Do you worry about accessibility? If so, did you test the tooltip with a screenreader? Afaik thats the best way to test for accessibility; validation not so much. Jörn On Mon, Oct 12, 2009 at 5:49 PM, shapper mdmo...@gmail.com wrote: Hello, I have been using Bassistance tooltip but I think the markup is really incorrect. http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ Why forcing an H3 into the tooltip? Did you ever checked a page with it in Opera's table of contents? By imposing H3 you are breaking the semantics of a page ... At least you could allow to have an option to have the H3 or not ... What do you think? Thanks, Miguel
[jQuery] Re: What causes a query string when request ing jQuery? e.g. /jquery-1.3.2.min.js?_=12553…
How is your page loading the '/Scripts/jquery-1.3.2.min.js' file? Whoever is generating that GET is adding the query string. I take it that it's not just being loaded with a simple script tag? If you can post a link to a test page, it would make it a lot easier to guess what might be happening. :-) -Mike On Mon, Oct 12, 2009 at 12:50 PM, Bob baconeater...@gmail.com wrote: I'm troubleshooting a page display glitch involving jQuery AJAX. When the glitch happens, Fiddler shows the following as one of the requests: GET /Scripts/jquery-1.3.2.min.js?_=1255309685187 Normally, the request has no query string and the response status code is 304: GET /Scripts/jquery-1.3.2.min.js However, every so often a query string is appended. Where does this query string come from? What does it mean? I wonder if the AJAX call fails, and then jQuery is refetched with that query string for some reason. The webserver is Visual Studio's Development Server, and I usually see this in IE8. Occasionally I'll see it in Firefox though. The app is ASP.NET MVC.
[jQuery] force a tab to move to next field on enter
Hi, I'm trying to change the enter event to a tab event. I know there are solutions out there that will do that but my form is a little bit complex in that it has fields that are not visible and this is done dynamically. I've tried some solutions (e.g. enter2tab plugin) but they don't seem to work so I was trying to hand code it myself. The bit that I am stuck on is how to invoke a tab event. I can't seem to get that to work. Can anyone help? I'm trying to invoke a tab key using: $j(this).trigger(keypress, [{keyCode:9}]); but it doesn't seem to work. Thanks
[jQuery] Problems in a jquery drop down menu
Hi there! In this site: http://work.r-m.me/termogreen/v2/ If you hover over a couple of times the Produtos's submenus (second level menus): - Energias renováveis - Água quente sanitária - Climatização - Tubagens e acessórios The sub sub menus won't appear (third level menus)... Anyone knows why? Thks in advance!
[jQuery] About load function
Hi, When i use a load call to get some HTML content from a remote page, the result display in the destination DIV is not immediate, but i have to call it again to see the result, but it is the result of the previous call How to make the display of retrived content immediate ? Thanks
[jQuery] animate queue :)
how can i create a queue what i want to do is onblur of a field 1) fade out current message in a div, 2)change the message 3) fade in new message (same div) when i try to do it it changes the html in the div then fades out and then in.. this is the code ive writeen $(#txt_user_name).blur(function () { $(#txt_user_name_msg).html('img src=/_images/ajax_loader.gif alt=O /'); if($(this).val() === ''){ $(#txt_user_name_msg).fadeOut(1000); $(#txt_user_name_msg).html('font color=#CCimg src=/ _images/ajax_error.gif alt=X / you must enter a username!/ font'); $(#txt_user_name_msg).fadeIn(1000); }else if($(this).val().length 3){ $(#txt_user_name_msg).fadeOut(1000); $(#txt_user_name_msg).html('font color=#CCimg src=/ adventure_dave/_images/ajax_error.gif alt=X / username too short!/ font'); $(#txt_user_name_msg).fadeIn(1000); }
[jQuery] Re: What causes a query string when request ing jQuery? e.g. /jquery-1.3.2.min.js?_=12553…
I was having this problem as well. When I turned changed the cache option off, it stopped happening to me.
[jQuery] Re: What causes a query string when request ing jQuery? e.g. /jquery-1.3.2.min.js?_=12553…
@ace: I tried passing ajaxOptions: { cache: false} to jQuery-UI Tabs and I think that did the trick! Is that what you were talking about? I struggled with this for far longer than I care to admit. Muchas gracias. Fiddler now shows a similar timestamp query string appended to my XHR. I guess the query string was being set by jQuery or jQuery-UI after all.
[jQuery] Re: loading message shows up after page has loaded
Thanks for you help Karl but that didn't seem to solve my problem. I have more info to add to the issue though. The Loading... message works great if there are say, images on the page loading. It does NOT work if I am waiting for a query to finish and it's results to be displayed back to the page. Any idea why it would work for one and not the other or how I can get it to work with a query too? DOES NOT WORK: script language=javascript type=text/javascript src=/tools/js/ jquery/jquery_1.2.4b.js/script script language=javascript type=text/javascript src=/tools/js/ jquery/jquery.blockui.js/script script $(document).ready(function() { $.blockUI(); $(window).load(function(){unBlockFunction(); }); }); function unBlockFunction(){ $.unblockUI(); } /script cfquery datasource=#application.dsn# name=qSelect maxrows=100 select * from user_info /cfquery cfdump var=#qSelect# DOES WORK: script language=javascript type=text/javascript src=/tools/js/ jquery/jquery_1.2.4b.js/script script language=javascript type=text/javascript src=/tools/js/ jquery/jquery.blockui.js/script script $(document).ready(function() { $.blockUI(); $(window).load(function(){unBlockFunction(); }); }); function unBlockFunction(){ $.unblockUI(); } /script img src=http://wnsl.physics.yale.edu/media/education_full.jpg;br img src=http://sprottshaw.com/uploads/images/Misc.%20Images/ 242351742.jpgbr img src=http://www.nfq.ie/nfq/en/images/FanDec2006.jpg;br img src=http://www.efytimes.com/admin/useradmin/photo/The%20Mobile %20Computer%20Education%20Bus.jpgbr On Oct 10, 9:54 am, Karl Swedberg k...@englishrules.com wrote: document.ready fires when the DOM is fully registered. If you have large images in the document, document.ready doesn't wait for those to completely load. So, it's typically earlier than window.onload, but it isn't going to fire before you see stuff on the page. I haven't tested this at all, and I'm just creating this in email, so proceed with caution ... but you might want to consider putting something like this in the head: script type=text/javascriptdocument.documentElement.className = 'js';/script and in your stylesheet do this: #uiblocker { display: none; } .js #uiblocker { display: block; left: 0; top: 0; width: 100%; height: 100%; position: fixed; cursor: wait; z-index:1001; } and in your html, put this right after the opening body tag: div id=uiblocker/div and in a javascript file, do this: $(window).bind('load', function() { $('#uiblocker').hide(); }); So, that /should/ work. For IE6 support, you'll need to either simulate position: fixed with a css expression or change it to position: absolute and hope for the best. Hope that helps. --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com On Oct 9, 2009, at 2:27 PM, sdtacoma wrote: Hello, I am using jQuery and BlockUI to display a Loading... message to the user while the page is loading. The problem is that the Loading... message seems to show up AFTER the page has loaded, not during load. Shouldn't the document.ready fire sooner than that? What am I doing wrong? script $(document).ready(function() { $.blockUI(); setTimeout($.unblockUI, 2000); }); /script
[jQuery] Re: What causes a query string when request ing jQuery? e.g. /jquery-1.3.2.min.js?_=12553…
@Michael: I just pull the scripts in like this: script src=/Scripts/jquery-1.3.2.min.js type=text/javascript/ script script src=/Scripts/jquery-ui-1.7.2.custom.min.js type=text/ javascript/script @ace: Which cache option is that? Bob
[jQuery] Re: possible to empty file input in form with .click or .focus ?
Sounds like a good idea - i'll give it a try in the morning and let you know if i have any luck wierd that there doesnt seem any way of directly altering the file inputs value... perhaps its a security thing... mkmanning wrote: You could replace the file input when the URL field is focused: $('#fu').replaceWith('input id=fu type=file /'); where #fu is the file input. On Oct 12, 11:53 am, amuhlou amysch...@gmail.com wrote: hmm yeah, I did a quick google search and it appears that allowing you to access a file input's value attribute would pose a security issue. I found a solution but the code isn't exactly prettyhttp://gusiev.com/2009/04/clear-upload-file-input-field/ On Oct 12, 6:43 pm, captaincarp harry.wi...@gmail.com wrote: Yeah this is what I've been trying, i think maybe different rules apply for file inputs perhaps? amuhlou wrote: Try: $('#input_id').focus(function(){ $(this).attr(value,); }); On Oct 12, 5:59 pm, captaincarp harry.wi...@gmail.com wrote: My image upload form has a choice of either upload image by entering url or by browsing for a file, I'm trying to empty the file-input input if you focus on the url-input. I've tried bother these events on click/blur but neither seem to work like they would for a checkbox or text input... $('#input_id').empty(); $('#input_id').attr('value', ''); any ideas would be help my head! -- View this message in context:http://www.nabble.com/possible-to-empty-file-input-in-form-with-.clic... Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- View this message in context:http://www.nabble.com/possible-to-empty-file-input-in-form-with-.clic... Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/possible-to-empty-file-input-in-form-with-.click-or-.focus---tp25860408s27240p25862884.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: animate queue :)
Rory you need to use the callback functions on your fadeIn/fadeOut commands. And ouch a FONT tag ! ie ... $(#txt_user_name_msg).fadeOut(1000, function(){$(this).html('img src=/_images/ajax_error.gif alt=error / span style=color:#cc;you must enter a username!/span').fadeIn (1000);}); On Oct 12, 3:48 pm, rory pickering rorypicker...@googlemail.com wrote: how can i create a queue what i want to do is onblur of a field 1) fade out current message in a div, 2)change the message 3) fade in new message (same div) when i try to do it it changes the html in the div then fades out and then in.. this is the code ive writeen $(#txt_user_name).blur(function () { $(#txt_user_name_msg).html('img src=/_images/ajax_loader.gif alt=O /'); if($(this).val() === ''){ $(#txt_user_name_msg).fadeOut(1000); $(#txt_user_name_msg).html('font color=#CCimg src=/ _images/ajax_error.gif alt=X / you must enter a username!/ font'); $(#txt_user_name_msg).fadeIn(1000); }else if($(this).val().length 3){ $(#txt_user_name_msg).fadeOut(1000); $(#txt_user_name_msg).html('font color=#CCimg src=/ adventure_dave/_images/ajax_error.gif alt=X / username too short!/ font'); $(#txt_user_name_msg).fadeIn(1000); }
[jQuery] (validate) Using text input arrays do not work
If you have the same 'name' for an input type, the error is only shown for the first one. For example, take the dynamic forms example: http://jquery.bassistance.de/validate/demo/dynamic-totals.html change the template it uses for adding rows and change it so the name of the input does not use the format {0} argument: input size='4' class=quantity min=1 id=item-quantity-{0} name=item-quantity / This should work as all the id's are unique and the names will cause an array to be formed. While the framework still attempts to validate - the error is only shown on the first text box. It should be shown on all items. If you correct the first item, the error will then be shown on the second item (if you hit submit) and so on. Please advise.
[jQuery] Re: possible to empty file input in form with .click or .focus ?
Yes, it is a security thing. Otherwise malicious developers would be adding paths to user's existing files and be able to silently upload user's files without their knowledge. On Oct 12, 11:33 am, captaincarp harry.wi...@gmail.com wrote: Sounds like a good idea - i'll give it a try in the morning and let you know if i have any luck wierd that there doesnt seem any way of directly altering the file inputs value... perhaps its a security thing... mkmanning wrote: You could replace the file input when the URL field is focused: $('#fu').replaceWith('input id=fu type=file /'); where #fu is the file input. On Oct 12, 11:53 am, amuhlou amysch...@gmail.com wrote: hmm yeah, I did a quick google search and it appears that allowing you to access a file input's value attribute would pose a security issue. I found a solution but the code isn't exactly prettyhttp://gusiev.com/2009/04/clear-upload-file-input-field/ On Oct 12, 6:43 pm, captaincarp harry.wi...@gmail.com wrote: Yeah this is what I've been trying, i think maybe different rules apply for file inputs perhaps? amuhlou wrote: Try: $('#input_id').focus(function(){ $(this).attr(value,); }); On Oct 12, 5:59 pm, captaincarp harry.wi...@gmail.com wrote: My image upload form has a choice of either upload image by entering url or by browsing for a file, I'm trying to empty the file-input input if you focus on the url-input. I've tried bother these events on click/blur but neither seem to work like they would for a checkbox or text input... $('#input_id').empty(); $('#input_id').attr('value', ''); any ideas would be help my head! -- View this message in context:http://www.nabble.com/possible-to-empty-file-input-in-form-with-.clic... Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- View this message in context:http://www.nabble.com/possible-to-empty-file-input-in-form-with-.clic... Sent from the jQuery General Discussion mailing list archive at Nabble.com. -- View this message in context:http://www.nabble.com/possible-to-empty-file-input-in-form-with-.clic... Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] strange position by using after
screenshot: http://tinypic.com/view.php?pic=2hd4f7ls=4 currently I've implement a key listen for moving the cursor (a gif actually) between each digits. my code looks like : var cursor = jQuery(#cursor); var current=... //current jquery element before cursor gif. if(keycode=){ current.after(cursor); } everything works fine with other numbers in the digit. except the last 1 in the numerator of the fraction. As shown in the screenshot, once we called current.after(cursor) here, the gif is rendered below the 321, which should be at the right side of 321. It's really wierd that, even in the firebugs, this td which contains the cursor.gif is already the last element of the tr. So it shoule be in the same line... But it doesn't actually... anyone knows why? it's tested in firefox 3.5.1
[jQuery] Re: About load function
It should be immediate. Please show us some of your code on how you're doing this. On Oct 12, 5:54 am, nabil.tn zouabi.na...@gmail.com wrote: Hi, When i use a load call to get some HTML content from a remote page, the result display in the destination DIV is not immediate, but i have to call it again to see the result, but it is the result of the previous call How to make the display of retrived content immediate ? Thanks
[jQuery] Re: strange position by using after
ps: this happened only when I move the cursor.gif from left side of 1 to the right side of 1. Here 1 is the last td of the row.
[jQuery] Re: loading message shows up after page has loaded
You've lost me there. If you're trying to block the page based on some user interaction, then the blockui plugin should work just fine. I thought the problem you were having, though, was with the page not being blocked immediately when the user first visits the page. You asked about document ready and whether it could fire sooner. I offered a solution that didn't rely on document ready so that the ui would be blocked immediately until everything was loaded. I put a test page up so you can see that it does, in fact, solve the problem that you originally presented: http://test.learningjquery.com/blockui.html Note that I added a setTimeout inside the $(window).load() function to simulate a heavy page. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Oct 12, 2009, at 4:59 PM, sdtacoma wrote: Thanks for you help Karl but that didn't seem to solve my problem. I have more info to add to the issue though. The Loading... message works great if there are say, images on the page loading. It does NOT work if I am waiting for a query to finish and it's results to be displayed back to the page. Any idea why it would work for one and not the other or how I can get it to work with a query too? DOES NOT WORK: script language=javascript type=text/javascript src=/tools/js/ jquery/jquery_1.2.4b.js/script script language=javascript type=text/javascript src=/tools/js/ jquery/jquery.blockui.js/script script $(document).ready(function() { $.blockUI(); $(window).load(function(){unBlockFunction(); }); }); function unBlockFunction(){ $.unblockUI(); } /script cfquery datasource=#application.dsn# name=qSelect maxrows=100 select * from user_info /cfquery cfdump var=#qSelect# DOES WORK: script language=javascript type=text/javascript src=/tools/js/ jquery/jquery_1.2.4b.js/script script language=javascript type=text/javascript src=/tools/js/ jquery/jquery.blockui.js/script script $(document).ready(function() { $.blockUI(); $(window).load(function(){unBlockFunction(); }); }); function unBlockFunction(){ $.unblockUI(); } /script img src=http://wnsl.physics.yale.edu/media/education_full.jpg;br img src=http://sprottshaw.com/uploads/images/Misc.%20Images/ 242351742.jpgbr img src=http://www.nfq.ie/nfq/en/images/FanDec2006.jpg;br img src=http://www.efytimes.com/admin/useradmin/photo/The%20Mobile %20Computer%20Education%20Bus.jpgbr On Oct 10, 9:54 am, Karl Swedberg k...@englishrules.com wrote: document.ready fires when the DOM is fully registered. If you have large images in the document, document.ready doesn't wait for those to completely load. So, it's typically earlier than window.onload, but it isn't going to fire before you see stuff on the page. I haven't tested this at all, and I'm just creating this in email, so proceed with caution ... but you might want to consider putting something like this in the head: script type=text/javascriptdocument.documentElement.className = 'js';/script and in your stylesheet do this: #uiblocker { display: none; } .js #uiblocker { display: block; left: 0; top: 0; width: 100%; height: 100%; position: fixed; cursor: wait; z-index:1001; } and in your html, put this right after the opening body tag: div id=uiblocker/div and in a javascript file, do this: $(window).bind('load', function() { $('#uiblocker').hide(); }); So, that /should/ work. For IE6 support, you'll need to either simulate position: fixed with a css expression or change it to position: absolute and hope for the best. Hope that helps. --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com On Oct 9, 2009, at 2:27 PM, sdtacoma wrote: Hello, I am using jQuery and BlockUI to display a Loading... message to the user while the page is loading. The problem is that the Loading... message seems to show up AFTER the page has loaded, not during load. Shouldn't the document.ready fire sooner than that? What am I doing wrong? script $(document).ready(function() { $.blockUI(); setTimeout($.unblockUI, 2000); }); /script
[jQuery] Don't use onclick
Am I wrong to say you should never use onclick in an element as this would be contrary to the purpose of using jQuery which means onclick would totally bind mark-up to javascript? So it would not be unobtrusive in that case. -- View this message in context: http://www.nabble.com/Don%27t-use-onclick-tp25865558s27240p25865558.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Accordion, there are too many
There are just too many accordions out there, can someone point me in the right direction. This need not be fancy: div class=post h3title 1/h3 psome copy here/p psome more copy here/p pand some more copy here/p h3title 2/h3 psome copy here/p psome more copy here/p pand some more copy here/p h3title 3/h3 psome copy here/p psome more copy here/p pand some more copy here/p /div On load, I would want the all p's hidden, which are in the class post, or, if I could say all p's that are children of the h3's, but I am not sure technically, they are children. The first h3 of course should not be hidden. On clicking any of the h3's, which I will href a link to '#' on, that one should go from hidden to shown. Clicking on any other h3, will toggle the one that is on, to off, and then turn the clicked one on. Basic, every example I find breaks in some way, or spends a lot of time prettying it up, which I do not need. A final link at the bottom to expand all would be nice. About 80% of the examples out there fail on more than 1 p tag after the h3. I suppose I am going to have to wrap each in a set of divs? Thanks -- Scott * If you contact me off list replace talklists@ with scott@ *
[jQuery] jQuery bug reports
In preparation for the push to a new release of jQuery, I've been cleaning up bug reports in the jQuery core bug tracker. Many tickets languiished because they weren't actually jQuery core bugs, but instead should have been reported on the forums or sent to the author of the plugin. jQuery UI also has its own bug tracker, http://dev.jqueryui.com/ . If I accidentally closed a ticket for the jQuery core code, feel free to reopen it. Please take the opportunity to check that the ticket has a clear test case and describes the browsers where you have been able to reproduce the problem. In general it's a good idea to post the problem on the forums to get a consensus on whether a bug ticket should be opened.
[jQuery] Unable to download jquery
Upon trying to download JQuery in either Internet Explorer or Firefox, I get the same error. Windows Script Host Script: C:\Documents and Settings\Couture\Local Settings|Temporary Interent Files\Content.IE5\RVWA8J02\jquery-1.3.2.min[1].js Line: 12 Char: 6947 Error: 'document' is undedined Code: 800A1391 Source: Microsoft JScript runtime error I have tried reinstalling Java, Internet Explorer 8, bought Registry Mechanic and cleaned my registry, I have tried a lot of things recommended on web sites, but nothing works. Can someone please direct me on how to successfully download JQuery so I can use it? Thank you -Arthur
[jQuery] Problems with load() in IIS?
I'm working on a project that uses the load() function to grab data from external files, but I keep getting a 405 Method Not Allowed error and the data won't load. I'm wondering if this is a problem with the server or if it's a sloppy mistake on my part. Any help would be greatly appreciated. Thanks, Scott
[jQuery] Using Jquery Form Plugin with Hidden fields
Hi, I am using the jquery form plugin and I am very surprised that it doesn't post hidden field values to my php file. I need form id=newTagForm action=ajax-add-tag.php method=post fieldset input type=hidden id=resourceID name=resourceID value= / input type=text id=usertags name=usertags value= / input type=submit id=addtag name=addtag value=Add / /fieldset /form Need to receive it like: $tagsString = makeDataSafe($_POST['usertags']); $resourceID = makeDataSafe($_POST['resourceID']); At the moment I've turned the hidden field into a text field and I'm hiding it. Is there a better way? James
[jQuery] (validate) How to get individual error messages and disable auto-showing
I'm trying to write a custom display for the error messages on my form. Ideally I'd like to use a modal pop-up window to display the errors, but I'm having trouble figuring out how to prevent the validation plugin from automatically displaying the errors on my page AND I can't quite figure out how to access the individual error messages for the elements on my form. What I want to do is to allow users to save invalid forms, but to warn them that they are invalid to make them confirm that they want to save. I have something like this: invalidHandler: function(form, validator) { //some code here figuring out if specific elements are within maxlength so as not to blow up the db if (canSave) { //canSave determined in the comments above var msg = There are errors...; for(errors in validator.errors) { msg = msg + br/ + errors.message; } jConfirm(msg, 'You can still save!', function(r) { if (r){ document.forms['myform'].submit(); } else { } }); if ( } else { jAlert('Cannot save right now', 'Unable to save'); } } Can I get access to the list of errors from the validator or even individually for each element in my form? and Can I turn off the auto showing of errors? Thanks!
[jQuery] 1.3.2, live(event), and trigger(event, [value1, value2])
Hello all, I cannot for the life of me figure out the syntax given in the subject line. Through all of the following, I am referring to the examples tab of the following page: http://docs.jquery.com/Events/trigger I've got a 'live' event, waiting for a custom trigger. I pull the trigger, fire the event, and all goes well. However, using the following trigger syntax, data pass-through does not perform at all as expected: myJQueryObject.trigger('myEvent', [value1, value2]); My event gets triggered, however all passed values are totally ignored, so far as I can tell. It seems to me that my live event's arguments are always firstly the event, and then my live event's selector (which is an attribute selector). The desired passed information does not seem to dwell in the event object, either. As far as I can tell after about an hour of tear-jerking tests, this is undocumented behavior. Furthermore, the only syntax I can coerce to properly function is to do the following: myJQueryObject.trigger('myEvent', { type : 'myEvent', var1 : value1, var2 : value2 }); This however makes the values attributes of the 'event' object. Workable, but I must ask the age-old linux question: Why does the documentation lie to us? I'd much prefer that either the original array-based syntax work as advertised, or someone alter that examples tab to clarify what is supposed to happen there. Thanks in advance, wonderful people.
[jQuery] Re: Unable to download jquery
Where are you downloading your jQuery file? You should go to jquery.com, click on the large Download( jQuery ); button, which will take you to the Google Code site, and click on another link. Where is the problem occuring? Also, Firefox shouldn't be triggering a Microsoft JScript runtime error. What happens when you did it with Firefox? On Oct 12, 11:48 am, Cooter1341 ajc1...@gmail.com wrote: Upon trying to download JQuery in either Internet Explorer or Firefox, I get the same error. Windows Script Host Script: C:\Documents and Settings\Couture\Local Settings|Temporary Interent Files\Content.IE5\RVWA8J02\jquery-1.3.2.min[1].js Line: 12 Char: 6947 Error: 'document' is undedined Code: 800A1391 Source: Microsoft JScript runtime error I have tried reinstalling Java, Internet Explorer 8, bought Registry Mechanic and cleaned my registry, I have tried a lot of things recommended on web sites, but nothing works. Can someone please direct me on how to successfully download JQuery so I can use it? Thank you -Arthur
[jQuery] Re: Problems with load() in IIS?
It sounds like a server setup issue. What is the file type/extension of the file that you're trying to load()? You have to set up the server so that the GET (and maybe POST) VERY is allowed for that file type. On Oct 12, 12:53 pm, Scogle scotto...@gmail.com wrote: I'm working on a project that uses the load() function to grab data from external files, but I keep getting a 405 Method Not Allowed error and the data won't load. I'm wondering if this is a problem with the server or if it's a sloppy mistake on my part. Any help would be greatly appreciated. Thanks, Scott
[jQuery] Re: Problems with load() in IIS?
Sorry, I meant VERB, not VERY: GET (and maybe POST) VERB On Oct 12, 3:42 pm, James james.gp@gmail.com wrote: It sounds like a server setup issue. What is the file type/extension of the file that you're trying to load()? You have to set up the server so that the GET (and maybe POST) VERY is allowed for that file type. On Oct 12, 12:53 pm, Scogle scotto...@gmail.com wrote: I'm working on a project that uses the load() function to grab data from external files, but I keep getting a 405 Method Not Allowed error and the data won't load. I'm wondering if this is a problem with the server or if it's a sloppy mistake on my part. Any help would be greatly appreciated. Thanks, Scott
[jQuery] How to create an Add New Option option to a select list
Hello all, I have a form that uses jeditable to edit-in-place several fields and select boxes. Everything is working great. Now I need to a way to add a new option to the select list. What I would like is the user select Add New... from the select list that would pop-up a dialog window where several fields are filled in. When the form is saved the select field is updated with the new ID and description. I use Facebox for pop-up windows to display notes when the user clicks on a topic. I know Facebox can be used to display a form. It would be ideal to use this ability when creating a new option for the select box. Does anyone know of a tutorial or can guide me in creating this? Thanks, Charles
[jQuery] Re: Problems in a jquery drop down menu
Hey all! I firebuged the site and noticed that a style=overflow:hidden was being added so I updated my code: $(this).css(overflow,visible); and for now seems ok. So I insist: Always firebug your applications! Cheers! On 12 Out, 17:03, Borgir ricardofmig...@gmail.com wrote: Hi there! In this site:http://work.r-m.me/termogreen/v2/ If you hover over a couple of times the Produtos's submenus (second level menus): - Energias renováveis - Água quente sanitária - Climatização - Tubagens e acessórios The sub sub menus won't appear (third level menus)... Anyone knows why? Thks in advance!
[jQuery] Standards
Am I wrong to say you should never use onclick in an element as this would be contrary to the purpose of using jQuery which means onclick would totally bind mark-up to javascript? So it would not be unobtrusive in that case. And can't you do this another way other than this: document.getElementById(productImage); And what about this, isn't the point of jQuery is to use Load? $(document).ready(function() { prodImage = document.getElementById(productImage); prodImage.onload = extraLargeLoad; });
[jQuery] Call function in load
Did I do this right? I can't test right now but I think this should work: function doSomething() { ... } (.someImage).load(doSomething()) ; I want to fire off doSomething() when the image is fully loaded.
[jQuery] Re: Don't use onclick
On Oct 13, 10:49 am, CoffeeAddict dschin...@gmail.com wrote: Am I wrong to say you should never use onclick in an element as this would be contrary to the purpose of using jQuery I think you have your design priorites backward. Firstly determine the functionality required, then how to best implement it. If that means using a library, then use it. If the library driving your design decisions, you might need to rethink using the library. which means onclick would totally bind mark-up to javascript? In a way that using a CSS selector to attach handlers doesn't? So it would not be unobtrusive in that case. The concept of unobtrusive javascript (i.e. attaching listeners at the client, rather than the server) is an implementation methodology that has been much hyped but probaby creates as many issues as it solves. -- Rob
[jQuery] Re: Call function in load
$(.someImage).load(doSomething); On Oct 12, 4:26 pm, expresso dschin...@gmail.com wrote: Did I do this right? I can't test right now but I think this should work: function doSomething() { ... } (.someImage).load(doSomething()) ; I want to fire off doSomething() when the image is fully loaded.
[jQuery] Re: Call function in load
yea, forgot about removing the (). Thanks. On Oct 12, 9:49 pm, James james.gp@gmail.com wrote: $(.someImage).load(doSomething); On Oct 12, 4:26 pm, expresso dschin...@gmail.com wrote: Did I do this right? I can't test right now but I think this should work: function doSomething() { ... } (.someImage).load(doSomething()) ; I want to fire off doSomething() when the image is fully loaded.
[jQuery] Re: Don't use onclick
I don't think it's too hyped. Having calls to javascript in your elements defeats the purpose of unobtrusively maintaining and using libraries like jQuery. How can you stay that Rob?? On Oct 12, 9:39 pm, RobG robg...@gmail.com wrote: On Oct 13, 10:49 am, CoffeeAddict dschin...@gmail.com wrote: Am I wrong to say you should never use onclick in an element as this would be contrary to the purpose of using jQuery I think you have your design priorites backward. Firstly determine the functionality required, then how to best implement it. If that means using a library, then use it. If the library driving your design decisions, you might need to rethink using the library. which means onclick would totally bind mark-up to javascript? In a way that using a CSS selector to attach handlers doesn't? So it would not be unobtrusive in that case. The concept of unobtrusive javascript (i.e. attaching listeners at the client, rather than the server) is an implementation methodology that has been much hyped but probaby creates as many issues as it solves. -- Rob
[jQuery] Re: Don't use onclick
unobtrusive in this case is keeping javascript out of elements. onclick= binds them together. On Oct 12, 9:39 pm, RobG robg...@gmail.com wrote: On Oct 13, 10:49 am, CoffeeAddict dschin...@gmail.com wrote: Am I wrong to say you should never use onclick in an element as this would be contrary to the purpose of using jQuery I think you have your design priorites backward. Firstly determine the functionality required, then how to best implement it. If that means using a library, then use it. If the library driving your design decisions, you might need to rethink using the library. which means onclick would totally bind mark-up to javascript? In a way that using a CSS selector to attach handlers doesn't? So it would not be unobtrusive in that case. The concept of unobtrusive javascript (i.e. attaching listeners at the client, rather than the server) is an implementation methodology that has been much hyped but probaby creates as many issues as it solves. -- Rob
[jQuery] Re: Don't use onclick
I think you have your design priorites backward. Firstly determine the functionality required, then how to best implement it. If that means using a library obviously we're past that point. We've decided this was a good use for jQuery. So how can you say priorities are tangled here when you assume we're overthinking this because we're using a library. It sounds as though you're a bit anti-new, stay hard core javascript type of dude. If you're using javascript to make an entire application fine, but I'm in with the new and new to me makes sense. Unobtrusive is not overrated, it's good practice and it's a pattern as far as I'm concerned. On Oct 12, 10:35 pm, expresso dschin...@gmail.com wrote: unobtrusive in this case is keeping javascript out of elements. onclick= binds them together. On Oct 12, 9:39 pm, RobG robg...@gmail.com wrote: On Oct 13, 10:49 am, CoffeeAddict dschin...@gmail.com wrote: Am I wrong to say you should never use onclick in an element as this would be contrary to the purpose of using jQuery I think you have your design priorites backward. Firstly determine the functionality required, then how to best implement it. If that means using a library, then use it. If the library driving your design decisions, you might need to rethink using the library. which means onclick would totally bind mark-up to javascript? In a way that using a CSS selector to attach handlers doesn't? So it would not be unobtrusive in that case. The concept of unobtrusive javascript (i.e. attaching listeners at the client, rather than the server) is an implementation methodology that has been much hyped but probaby creates as many issues as it solves. -- Rob
[jQuery] Re: Don't use onclick
The simple fact that you don't have javascript floating all over your doc inside elements is alone a reason that unobtrusive rocks. Let alone many other reasons. On Oct 12, 10:44 pm, expresso dschin...@gmail.com wrote: I think you have your design priorites backward. Firstly determine the functionality required, then how to best implement it. If that means using a library obviously we're past that point. We've decided this was a good use for jQuery. So how can you say priorities are tangled here when you assume we're overthinking this because we're using a library. It sounds as though you're a bit anti-new, stay hard core javascript type of dude. If you're using javascript to make an entire application fine, but I'm in with the new and new to me makes sense. Unobtrusive is not overrated, it's good practice and it's a pattern as far as I'm concerned. On Oct 12, 10:35 pm, expresso dschin...@gmail.com wrote: unobtrusive in this case is keeping javascript out of elements. onclick= binds them together. On Oct 12, 9:39 pm, RobG robg...@gmail.com wrote: On Oct 13, 10:49 am, CoffeeAddict dschin...@gmail.com wrote: Am I wrong to say you should never use onclick in an element as this would be contrary to the purpose of using jQuery I think you have your design priorites backward. Firstly determine the functionality required, then how to best implement it. If that means using a library, then use it. If the library driving your design decisions, you might need to rethink using the library. which means onclick would totally bind mark-up to javascript? In a way that using a CSS selector to attach handlers doesn't? So it would not be unobtrusive in that case. The concept of unobtrusive javascript (i.e. attaching listeners at the client, rather than the server) is an implementation methodology that has been much hyped but probaby creates as many issues as it solves. -- Rob
[jQuery] Expanding or contracting on resize?
Is there a way to tell if the user is expanding or contracting the window when resizing even if he changes directions during the same event?