[#3740] javascript for Horde_Form_Type_assign broken
Summary javascript for Horde_Form_Type_assign broken
Queue Horde Framework Packages
Queue Version HEAD
Type Bug
State Resolved
Priority 1. Low
Owners chuck (at) horde (dot) org
Requester dorm (at) dorm (dot) org
Created 2006-04-05 (5408 days ago)
Updated 2006-04-23 (5390 days ago)
Assigned 2006-04-08 (5405 days ago)
Resolved 2006-04-23 (5390 days ago)
Patch No

2006-04-23 02:23:02 Chuck Hagenbuch Deleted Original Message
2006-04-23 02:22:51 Chuck Hagenbuch Comment #11
State ⇒ Resolved
New Attachment: assign[1].php Download
Reply to this comment
The javascript should be all set now. As for preserving values, you 
need to call getInfo() for that to work properly. Also, the assign 
type isn't set up right now to preserve keys. See the attached...
2006-04-20 19:01:07 dorm (at) dorm (dot) org Comment #10
New Attachment: assign.php
Reply to this comment
Sure.  It's part of a user profile module I am working on called Bios. 
  I actually am no longer using the assign field type, either, but I 
kept the code around for testing/verification of this bug.

I've stripped out most of the application-specific stuff from it, but 
it is enough that you see how I'm setting up the assign variable.

2006-04-20 17:58:48 Chuck Hagenbuch Assigned to Chuck Hagenbuch
2006-04-20 17:58:32 Chuck Hagenbuch Comment #9
Summary ⇒ javascript for Horde_Form_Type_assign broken
Reply to this comment
Can you attach the code you're using to test this? I can only find one 
instance of the assign type being used, and it's in Occam, which I 
don't have set up. I'll get to it eventually if you can't, but code 
would help me out. Thanks!
2006-04-20 17:13:39 dorm (at) dorm (dot) org Comment #8 Reply to this comment
I still get a couple JS errors with that code, mostly because of 
incorrect var names.  I think this should do it:

--- form_assign.js.1.4  2006-04-20 11:10:48.419915568 -0600

+++ form_assign.js      2006-04-20 10:37:39.825227912 -0600

@@ -47,7 +47,7 @@



-    this.setField(name);

+    this.setField(form, elt);


  Horde_Form_Assign.setField = function(form, elt)

@@ -79,5 +79,5 @@

      if (hit) {

          values = values.substring(0, values.length - 1);


-    document[name + '__values'].value = values;

+    document.forms[form].elements[elt + '__values'].value = values;


Also, the display of the assign field is not correctly maintained 
across form submissions.  I'm not sure the __value element is 
correctly being parsed into the leftValues and rightValues arrays.

2006-04-20 16:12:05 Chuck Hagenbuch Deleted Original Message
2006-04-20 15:17:38 dorm (at) dorm (dot) org Comment #6 Reply to this comment
...and the same behavior on Windows IE and Firefox.

2006-04-20 04:20:42 dorm (at) dorm (dot) org Comment #5 Reply to this comment
I get Javascript parse errors on js/src/form_assign.js, line 16:   
Error: missing formal parameter at 'var'

This happens in Safari and Mac Firefox.  I will check on Windows 
browsers tomorrow.

2006-04-09 00:03:58 Chuck Hagenbuch Comment #4 Reply to this comment
Please try this commit:


If it checks out I'll merge it to Horde 3.1.2.
2006-04-08 09:08:16 Jan Schneider Comment #3
State ⇒ Feedback
Reply to this comment
The patch looks good and should work in all browser, but I think it 
would make more sense to pass the form and field name separately to 
the function. It's kind of awkward to concatenate them in the PHP code 
first, only to split them later in the js code.
2006-04-07 04:47:42 Chuck Hagenbuch Deleted Original Message
2006-04-05 23:05:47 dorm (at) dorm (dot) org Comment #2
New Attachment: form_assign.js.[1].patch
Reply to this comment
Sorry, I have a typo in that patch file.  Here is the correct one.

2006-04-05 22:35:41 dorm (at) dorm (dot) org Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 1. Low
Summary ⇒ javascript for 'assign' type Horde_Form elements broken
Queue ⇒ Horde Framework Packages
New Attachment: form_assign.js.
Reply to this comment
The javascript code in js/form_assign.js is broken for moving select 
options back and forth between the two select lists for Horde_Form 
'assign' elements.

I've verified this behavior in Windows Firefox and IE.  I will check 
on MacOS Firefox and Safari when I get home and will update.

The current code obtains the form element objects through the 
document[] array, which doesn't work.

I've attached a patch which obtains the objects through the 
document.forms[...].elements[...] array(s).  It first splits the 
'name' parater to separate the form and select element names.

This patched code works on Windows Firefox and IE, and I will verify 
on MacOS Firefox and Safari.

Saved Queries