Re: [Proto-Scripty] multipart/form-data upload via ajax
Try this solution: http://www.webtoolkit.info/Ajax file upload http://www.webtoolkit.info/ajax-file-upload.html Anyone have any idea how to do a file upload using ajax? If I do this using the normal submit it works just fine but having it call the dosubmit function and I get the form data but no file. ($_FILE is empty with no errors) function dosubmit(url) { // append extension to form processor to keep chinese out of your stuff new Ajax.Updater( 'result', url +.php, { method: 'post', parameters: $('myform').serialize(), onSuccess: fill_in, onFailure: ajax_err} ); } form name='anisForm' id='myform' action='image_upload' method='post' enctype=multipart/form-data fieldset legendStep 3: Provide An Image/legend label id='labfldr_image' for='ajfldr_image'Choose A Folder Cover Image:/label input type='file' name='fldr_image' size='81' maxlength='256' id='ajfldr_image' input type='hidden' name='MAX_FILE_SIZE' value='10M' /fieldset input type='button' id='submit' onclick='dosubmit(image_upload)' value='Save' !-- input type='submit' id='submit' value='Save' -- input type='reset' value='Reset' /form -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To unsubscribe from this group and stop receiving emails from it, send an email to prototype-scriptaculous+unsubscr...@googlegroups.com. To post to this group, send email to prototype-scriptaculous@googlegroups.com. Visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Proto-Scripty] как создавать в классе правильно частные и публичные методы и свойства
I read and understand a lot of russian but I'd rather not try to write it. Hope answer in english will be of any help to you. To have private functions and properties you need to use clousure like this: var AClass = Class.create((function() { var _stat = 'I am static private'; function initialize() { this.test = 'I am private'; } function _priv() { console.log(this.test); } function _private() { console.log(_stat); } return { initialize: initialize, pub: function() { _priv.apply(this); }, publi: function() { _private(); }, setpubli: function() { _stat = 'after set'; } }; })()); document.observe(dom:loaded, function() { var a = new AClass(); a.pub(); a.publi(); a.setpubli(); var b = new AClass(); b.publi(); }); Inheritance: var ASubClass = Class.create(AClass, (function() { function initialize($super) { $super($A(arguments)); } return { initialize: initialize, pfun: function() { console.log('in sub '); } }; })()); There is much more to explore on this subject. Have fun Вот например класс var myClass=Class.create ( initialize :function(){} , action:function () {} ) Метод action публичный(я так понимаю)...а как создать приватный метод -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/s5jE0forsHgJ. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
Re: [Proto-Scripty] как создавать в классе правильно частные и публичные методы и свойства
Sorry, one not so small mistake: should be function initialize() { this.test = 'I am public'; } this is public of course I read and understand a lot of russian but I'd rather not try to write it. Hope answer in english will be of any help to you. To have private functions and properties you need to use clousure like this: var AClass = Class.create((function() { var _stat = 'I am static private'; function initialize() { this.test = 'I am private'; } function _priv() { console.log(this.test); } function _private() { console.log(_stat); } return { initialize: initialize, pub: function() { _priv.apply(this); }, publi: function() { _private(); }, setpubli: function() { _stat = 'after set'; } }; })()); document.observe(dom:loaded, function() { var a = new AClass(); a.pub(); a.publi(); a.setpubli(); var b = new AClass(); b.publi(); }); Inheritance: var ASubClass = Class.create(AClass, (function() { function initialize($super) { $super($A(arguments)); } return { initialize: initialize, pfun: function() { console.log('in sub '); } }; })()); There is much more to explore on this subject. Have fun Вот например класс var myClass=Class.create ( initialize :function(){} , action:function () {} ) Метод action публичный(я так понимаю)...а как создать приватный метод -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/s5jE0forsHgJ. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
Re: [Proto-Scripty] equal height problem with nested divs in product grid
In case you would like to make equal columns heigt with pure css only try to modify/add your css this: #products-list-view div.products-grid div { padding-bottom: 500px; margin-bottom: -500px; } Should do what you want. -wz Hello Everybody, I have an equal-height problem I want to solve using the Prototype-Framework. The problem presents itself in the context of the following HTML-Markup of a Product Grid: div id=products-list-view div class=products-grid div class=itemContents/div div class=itemContents/div div class=itemContents/div /div div class=products-grid div class=itemContents/div div class=itemContents/div div class=itemContents/div /div ... /div The Style-Declaration for the markup above are as follows: #products-list-view div.products-grid { border-bottom: 1px #B7B9B8 dotted; display: block; height: 100%; overflow: hidden; padding: 0 0 0 1.6%; } #products-list-view div.products-grid div { display: block; float: left; margin: 0 3% 0 0; padding: 30px 0 30px 0; position: relative; width: 30%; } The div class=item elements have different heights since their amount of contents vary. In order to harmonize the height of every div class=item element in every div class=products-grid row I used the following Javascript/Prototype code. script type=text/javascript //![CDATA[ // loop through all div.products-grid elements $$('div.products-grid').each(function(r) { // get the height of the current div.products-grid element var rowHeight = r.getHeight(); // for debuggin purposes // alert(rowHeight); // select all div.item element within the current div.product-grid element var columns = r.select('div.item'); // make each div.item element as high as the current div.product-grid element columns.invoke('setStyle', {height: rowHeight + 'px'}); }); //]] /script Unfortunately the codes doesn't work. The height which is assigned to the div class=item element via the setStyle method doesn't correspond to the height I get shown on the screen when I would use the alert(rowHeight) method. However this is only the case when I choose to comment out the alert(rowHeight) method. When I choose to use it, the correct height is written in the style-declaration created via the setStyle method. I really don't get this. Does anyone have an idea how to fix that? Best regards and thank you, Matthias -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/3EBJVQuxq54J. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
Re: [Proto-Scripty] Move sortables with javascript?
I do not know if my advice will be valuable for you but I would avoid sorting divs with javascript. I think better way is to read the cookie in php and render a page with divs in order according to cookie data. Difficulty of that task is probably determinded by the way you render you html pages. With some template engine (like smarty) should be rather easy... -wz Is there a way to move a sortables with javascript? Example: A user sorts a few divs and the order is stored in a cookie with Sortable.serialize. How to use the data in the cookie to rearrange the divs to the order of the user, when he is visiting the site the next time? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/-ZXsnxsRFNMJ. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
Re: [Proto-Scripty] Tactical Advice: Many rows, one checkbox per row
Sorry for the mess I produced. Of course all this stuff with _checked array is not necessery if you want send AjaxRequest immediatly after checkbox click - just extract the clicked item and send all needed data including checkbox state as you do. -wz Hi I wrote a routine (not sure if it fits exactly what you need), yet it presents the logic and maybe you will be able to fit in your code. Notice it is not tested and uses prototype 1.7. It is wrote as clousure yet you may transfer it easly into Object Literal or class or something. Ah - and there is only one observer - on form: Here you are: (function() { var _checked = undefined; document.observe(dom:loaded, function() { // select all checked ckeckboxes _checked = $('formId').select('input[checked]').pluck('value'); //register observer on form click $('formId').on('click', _onClick); }); function _onClick(event, element) { var isUnchecked = undefined; //if clicked element is input if (element.tagName.toLowerCase() == 'input') { // here we find out if our checkbox was checked or not at time of page loaded (isUnchecked == true shows it was checked and now is not) isUnchecked = _checked.indexOf(element.value) -1 ? true : false; // send Ajax request _sendAjaxRequest(element, isUnchecked); } } function _sendAjaxRequest(element, isUnchecked) { new Ajax.Request('url', { method: 'post', parameters: { here you serialize your checkbox (element) manually}, onSuccess: function(transport) { var response = transport.responseText.evalJSON(); .. }, onComplete: function() { } }); } })(); Hope it helps -wz I just drastically shortened this down... I'm now serializing the data manually with: strSerialize = active_record= +cbValue +state= +strState; Which produces: active_record=5state=checked On the server side I can easily get the two values with $_POST... so far perfect... I've deleted all the hidden fields... Now when you click on the checkbox, onchange does all the work and since I enable/disable the form, only one submission happens at a time... exactly as we want it... Working perfectly... Thanks for the help! On Thu, Apr 26, 2012 at 10:51 AM, Phil Petree phil.pet...@gmail.com mailto:phil.pet...@gmail.com wrote: I got it working... here's where I am so far: 1) at the top of the form I created a hidden input called 'active_record' which holds the $('id') of the row in progress 2) each row has input type=hidden name=$record_num value='' input type=checkbox value=$record_num checked='checked/unchecked' onchange='updateRow(this.id http://this.id, this.value);' 3) updateRow(cbID, cbValue) {} wherein I set the value of the hidden $record_num with checked || unchecked and active_record with the cbValue and then call my ajax function which serializes the form and makes the call. 4) oncomplete: I clear the two hidden inputs. In my php code I can check my $_POST: $record = $_POST['active_record']; $value = $_POST[$record]; error_log(record num is: $record and is set to $value); Problem: I'm still sending all the rows where the type=checkbox has checked=checked but I'm not processing those. Has no real impact on performance right now but with 1000's of users and frequent approval/disapprovals, it will unnecesssarily suck up bandwidth and time. Any idea how to serialize just one field? Afterall, all I really need to do is send the checked/unchecked from the active_records hidden input... -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
Re: [Proto-Scripty] stupid checkbox question
$(cbValue).checked returns boolean (true|false) and you compare it to string: if( cbState == checked ) simply strState = (cbState == true) ? checked : unchecked; -wz Try it passing cb1 into a function as cbValue and then $(cbValue).checked... On Apr 27, 2012 1:46 AM, Wojtek Zadora woj...@studioatrium.pl mailto:woj...@studioatrium.pl wrote: Well, I tested it and in my case having input type=checkbox name=1 value=1 id=cb1 console.log($('cb1').checked); - returns false console.log($('cb1').readAttribute('checked')); - returns null While input type=checkbox name=2 value=2 id=cb2 checked=checked console.log($('cb2').checked); - returns true console.log($('cb2').readAttribute('checked')); - returns checked -wz How do you get the checked state of a single checkbox? $('cbID').checked doesn't work... also tried $F('cbID').checked in the following function, the alert comes back with undefined cdValue is the id of the checkbox... function saveChange(cbValue) { var strState; var cbState; // get the value of the checkbox // we do it here incase this is called // from the onchange attached to the select cbState = $(cbValue).checked; alert(cbState); if( cbState == checked ) strState = checked; else strState = unchecked; } -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us http://script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com mailto:prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com mailto:prototype-scriptaculous%2bunsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us http://script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com mailto:prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com mailto:prototype-scriptaculous%2bunsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
Re: [Proto-Scripty] stupid checkbox question
Well, I tested it and in my case having input type=checkbox name=1 value=1 id=cb1 console.log($('cb1').checked); - returns false console.log($('cb1').readAttribute('checked')); - returns null While input type=checkbox name=2 value=2 id=cb2 checked=checked console.log($('cb2').checked); - returns true console.log($('cb2').readAttribute('checked')); - returns checked -wz How do you get the checked state of a single checkbox? $('cbID').checked doesn't work... also tried $F('cbID').checked in the following function, the alert comes back with undefined cdValue is the id of the checkbox... function saveChange(cbValue) { var strState; var cbState; // get the value of the checkbox // we do it here incase this is called // from the onchange attached to the select cbState = $(cbValue).checked; alert(cbState); if( cbState == checked ) strState = checked; else strState = unchecked; } -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
Re: [Proto-Scripty] Effect.SlideDown: the 'afterFinish' callback fires immediately
Try this Effect.SlideDown($('floating_basket_wrapper'), { duration: 5, afterFinish: function() { console.log('afterFinish'); } }); -wz Hello, I am using the following code: Effect.SlideDown($('floating_basket_wrapper'), { duration: 5, afterFinish: console.log('afterFinish') }); The effect triggers fine, however I see 'afterFinish' right after starting the movement in the console and not after the effect has finished. To me, this seems like a bug, or am I doing something wrong here? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/AEoBwMagov8J. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Reference to event
Sorry it was stupid question - I may set condition before even creating effect. Sorry - no question -wz Hi Sorry if the subject was ever discussed, but I cannot find any hint for it. My question is as follows: Is there any way to get reference to the Effect from within the callback function? Sample: new Effect.BlindUp(element, { duration: 0.5, beforeStart: function() { if(condition) { // here I need reference to the Effect, to cancel it (for egzample) } } }); Tried bind this on some different ways without success. Appreciate any help. -wz -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.