[dev] [PATCH] turba/add.php

Marc Jauvin marc at r4l.com
Wed Oct 12 13:21:14 PDT 2005


The following patch fixes this problem by using the "elements" 
attribute of the form object:

Index: framework/Form/Form/Renderer.php
===================================================================
RCS file: /repository/framework/Form/Form/Renderer.php,v
retrieving revision 1.199
diff -u -r1.199 Renderer.php
--- framework/Form/Form/Renderer.php    7 Aug 2005 01:14:25 -0000       1.199
+++ framework/Form/Form/Renderer.php    12 Oct 2005 20:19:54 -0000
@@ -196,7 +196,7 @@
             echo '<script type="text/javascript">
<!--
try {
-    document.' . $this->_name . '.' . $this->_firstField . '.focus();
+    document.' . $this->_name . '.elements["' . $this->_firstField . 
'"].focus();
} catch(e) {}
//-->
</script>




Marc Jauvin <marc at r4l.com> wrote:

> Marc Jauvin <marc at r4l.com> wrote:
>
>> Jan Schneider <jan at horde.org> wrote:
>>
>>> Zitat von Marc Jauvin <marc at r4l.com>:
>>>
>>>> I tried removing the "notification" line for the focus, but it does not
>>>> seem to work... a way around this would be to use the form name in the
>>>> previous code I submitted:
>>>
>>> It works fine for me. Like with *any* other form generated by
>>> Horde_Form. Note that the first field is the drop down list if you have
>>> more than one address book.
>>
>> Hmmm, I don't know why, but this does not work for me. I have a single
>> addressbook, but there is still a Drop down that is shown (with a
>> single value).
>>
>> I'm using latest HEAD, so we should be running the same code, right?
>
> OK, here is what I found: the javascript that's generated by the
> Horde_Form to set the focus looks something like this in my case:
>
>  <script type="text/javascript">
>  <!--
>  try {
>      document.horde_form.object[name].focus();
>  } catch(e) {}
>  //-->
>  </script>
>
> I am guessing the "object[name]" will clash with JS arrays... I am
> using the following (default) mapping for my SQL source:
>
>    'map' => array(
>        '__key' => 'object_id',
>        '__owner' => 'owner_id',
>        '__type' => 'object_type',
>        '__members' => 'object_members',
>        'uid' => 'object_uid',
>        'name' => 'object_name',
>        'email' => 'object_email',
>        'altEmail' => 'object_altemail',
>        'alias' => 'object_alias',
>        'homeAddress' => 'object_homeaddress',
>        'workAddress' => 'object_workaddress',
>        'homePhone' => 'object_homephone',
>        'workPhone' => 'object_workphone',
>        'cellPhone' => 'object_cellphone',
>        'fax' => 'object_fax',
>        'title' => 'object_title',
>        'company' => 'object_company',
>        'notes' => 'object_notes',
>        'pgpPublicKey' => 'object_pgppublickey',
>        'smimePublicKey' => 'object_smimepublickey',
>        'freebusyUrl' => 'object_freebusyurl'
>    ),
>
>
> --
> Marc Jauvin
> http://register4less.com
> 514-905-6500
>
> --
> Horde developers mailing list - Join the hunt: http://horde.org/bounties/
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: dev-unsubscribe at lists.horde.org
>



-- 
Marc Jauvin
http://register4less.com
514-905-6500


More information about the dev mailing list