Hi, I need gurus help.
Prototype.js = 1.5.0
Scriptaculous = 1.7.0
I've been trailing a JS error that appears in IE 6 WinXP. Firefox is
ok.
I have a statically generated form. Data is imported by AJAX. Form is
saved with AJAX.
All is good.
Smack in the middle of the form, there is a list of items (sortable
with the help of Scriptaculous). Inside the <LI>s are <input hidden>s,
registering the orders. Changing those and saving.
All is good.
Next to the list is a <select> providing a list of possible new
additions to the list. You select the item and press a button. A JS
function output a string containing markup for the item and append it
to the innerHTML of the list container <UL>.
function addItem(){
var list = $('list'); //
reference
var item = document.edition.selectItems.value; // select current
value
var objItem = eval('('+item.replace(/'/g,'\"')+')'); // transfers
value in JS object
var addstr = strListItem(objItem); // produce
string from other function with
var currentHTML = list.innerHTML; // store old
innerHTML
list.innerHTML = ''; //
clear innerHTML
list.innerHTML = currentHTML + addstr; // put back full
innerHTML
Sortable.destroy(\"list_p\"); //
explicitely destroy Sortable
Sortable.create(\"list_p\",{onUpdate:updateOrdre}); // recreate
sortable
updateOrdre(list); //
run ordering function
}
This is the str output function
function strListItem(objItem){
var list = $('list');
var id = objItem.id;
var fn = objItem.FirstName;
var ln = objItem.LastName;
var str = '<li id="p_'+id+'"><span class="handle"><img src="../images/
arrow_UD.gif" alt="Ordre" /><'+'/span>'
+' <input type="hidden" name="intOrdre_'+id+'" value="" />'
+' <label class="fix">'+fn+' '+ln+'</label>'
+' <input type="button" name="delete" value="X" onClick=
\"confirmation = confirm('Want to delete?');if(confirmation)
{doDelPharm('p_'+id+'');}\" /></li>';
return str;
}
I had a "handle" option in Sortable.create, but it gave me an error in
IE...
var Enumerable = {
each: function(iterator) {
var index = 0;
try {
this._each(function(value) {
try {
iterator(value, index++);
} catch (e) {
if (e != $continue) throw e;
}
});
} catch (e) { <----------------------------------right
here
if (e != $break) throw e;
}
return this;
},
I hoped for the best when I could add items to the list in IE without
having this problem. But when I clicked save, BANG! same error. I
commented all the "saveEdition" function and uncommented one line at a
time until the error appeared. VoilĂ !
var data = Form.serialize(document.edition);
Before, I had the nicer form
$('edition').serialize()
or the shorter form
document.edition.serialize();
but no difference.
In short the question is:
Form.serialize(form) -> each = error JS =>WHY?!?
If you want more detail, I'll provide.
BTW. does any of you know a GOOD solution to troubleshoot javascript
inside IE for Win? I downloaded Microsoft Script Debugger, it just
keep crashing.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---