PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Unable to edit form field in admin area (Patch included)

  1. About a month ago on our website, we found we were unable to edit the fields for any forms in the admin area. I see a few people have had a similar issue on these forums, but I'm making a new thread to discuss a proper fix for this bug.

    I found the problem to be caused by an error being thrown by the javascript code in form_admin.js. See the error here: http://i.imgur.com/jto8exS.png. Why is this error being thrown? Well, that's because of the code 2 lines above where the error is being thrown.

    for(i in classes) {

    The problem here is for(X in Y) loops enumerate properties of an object. This is similar, but not the same as how a regular for(;;) loop works: by iterating the indices of an array (the correct functionality for this case.) Because the script is currently using a for(X in Y) loop, it is trying to perform functions using various properties, as well as any array index. The fix is to simply use a regular for(;;) loop...

    for(var i=0; i > classes.length; i++) {

    As for why this bug isn't causing problems for everyone, and why it only started causing problems for us recently, I would say it probably is due to another module we are using that is adding properties to Arrays.

    As looping through all of the Arrays' properties isn't the intended functionality, I think this should be patched up. There are a few other for(X in Y) loops that should be changed to for(;;) loops in the script too; they're not causing any issues for me, but it's best to be prudent.

    Posted 11 years ago on Thursday June 6, 2013 | Permalink
  2. David Peralty

    I'll send this to our development team.

    Posted 11 years ago on Thursday June 6, 2013 | Permalink