Re: svn commit: r1031655 - /ofbiz/trunk/framework/images/webapp/images/selectall.js

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1031655 - /ofbiz/trunk/framework/images/webapp/images/selectall.js

Jacques Le Roux
Administrator
Hi Andrew,

I try to understand how and when this is helpful. In other words why did you add this? Could you please give an example?
This question because I wonder if I should use it in the jQuery branch.

Thanks

Jacques

From: <[hidden email]>

> Author: jaz
> Date: Fri Nov  5 16:13:00 2010
> New Revision: 1031655
>
> URL: http://svn.apache.org/viewvc?rev=1031655&view=rev
> Log:
> small change to call the onchange event when updating the autocomplete fields after the description is set
>
> Modified:
>    ofbiz/trunk/framework/images/webapp/images/selectall.js
>
> Modified: ofbiz/trunk/framework/images/webapp/images/selectall.js
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/selectall.js?rev=1031655&r1=1031654&r2=1031655&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/images/webapp/images/selectall.js (original)
> +++ ofbiz/trunk/framework/images/webapp/images/selectall.js Fri Nov  5 16:13:00 2010
> @@ -410,6 +410,12 @@ function setLookDescription(textFieldId,
>         tooltipElement.update(description);
>         lookupWrapperEl.appendChild(tooltipElement);
>     }
> +
> +    // after the description is set; the text field may have been updated
> +    // just in case, call onchange again
> +    if ($(textFieldId).onchange != null) {
> +    $(textFieldId).onchange();
> +    }
> }
>
> /** Enable auto-completion for drop-down elements.
>
>


Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1031655 - /ofbiz/trunk/framework/images/webapp/images/selectall.js

Andrew Zeneski-4
Jacques,

When using the auto complete, the value isn't properly set until after
the description is parsed. The value field may contain the key and the
description until after it is parsed out. The onchange event runs
before this happens, so it needs to be called after the string is
parsed and placed into the proper fields.

That explains why the onchange event is called from here. The reason
the onchange event is called in the first place is because these
events don't trigger when you set values programmatically only when
the value is actually changed by the user (through the browser). So we
call the event manually to make sure any listeners are notified.


---
Andrew Zeneski
[hidden email]



---------- Forwarded message ----------
From: "Jacques Le Roux" <[hidden email]>
To: <[hidden email]>
Date: Sun, 7 Nov 2010 16:49:50 +0100
Subject: Re: svn commit: r1031655 -
/ofbiz/trunk/framework/images/webapp/images/selectall.js
Hi Andrew,

I try to understand how and when this is helpful. In other words why
did you add this? Could you please give an example?
This question because I wonder if I should use it in the jQuery branch.

Thanks

Jacques

From: <[hidden email]>
Author: jaz
Date: Fri Nov  5 16:13:00 2010
New Revision: 1031655

URL: http://svn.apache.org/viewvc?rev=1031655&view=rev
Log:
small change to call the onchange event when updating the autocomplete
fields after the description is set

Modified:
  ofbiz/trunk/framework/images/webapp/images/selectall.js

Modified: ofbiz/trunk/framework/images/webapp/images/selectall.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/selectall.js?rev=1031655&r1=1031654&r2=1031655&view=diff
==============================================================================
--- ofbiz/trunk/framework/images/webapp/images/selectall.js (original)
+++ ofbiz/trunk/framework/images/webapp/images/selectall.js Fri Nov  5
16:13:00 2010
@@ -410,6 +410,12 @@ function setLookDescription(textFieldId,
       tooltipElement.update(description);
       lookupWrapperEl.appendChild(tooltipElement);
   }
+
+    // after the description is set; the text field may have been updated
+    // just in case, call onchange again
+    if ($(textFieldId).onchange != null) {
+    $(textFieldId).onchange();
+    }
}
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1031655 - /ofbiz/trunk/framework/images/webapp/images/selectall.js

Jacques Le Roux
Administrator
Thanks Andrew,

It's quite clear now, I will see what to do in jQuery branch, I guess the same

Jacques

From: "Andrew Zeneski" <[hidden email]>

> Jacques,
>
> When using the auto complete, the value isn't properly set until after
> the description is parsed. The value field may contain the key and the
> description until after it is parsed out. The onchange event runs
> before this happens, so it needs to be called after the string is
> parsed and placed into the proper fields.
>
> That explains why the onchange event is called from here. The reason
> the onchange event is called in the first place is because these
> events don't trigger when you set values programmatically only when
> the value is actually changed by the user (through the browser). So we
> call the event manually to make sure any listeners are notified.
>
>
> ---
> Andrew Zeneski
> [hidden email]
>
>
>
> ---------- Forwarded message ----------
> From: "Jacques Le Roux" <[hidden email]>
> To: <[hidden email]>
> Date: Sun, 7 Nov 2010 16:49:50 +0100
> Subject: Re: svn commit: r1031655 -
> /ofbiz/trunk/framework/images/webapp/images/selectall.js
> Hi Andrew,
>
> I try to understand how and when this is helpful. In other words why
> did you add this? Could you please give an example?
> This question because I wonder if I should use it in the jQuery branch.
>
> Thanks
>
> Jacques
>
> From: <[hidden email]>
> Author: jaz
> Date: Fri Nov  5 16:13:00 2010
> New Revision: 1031655
>
> URL: http://svn.apache.org/viewvc?rev=1031655&view=rev
> Log:
> small change to call the onchange event when updating the autocomplete
> fields after the description is set
>
> Modified:
>  ofbiz/trunk/framework/images/webapp/images/selectall.js
>
> Modified: ofbiz/trunk/framework/images/webapp/images/selectall.js
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/selectall.js?rev=1031655&r1=1031654&r2=1031655&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/images/webapp/images/selectall.js (original)
> +++ ofbiz/trunk/framework/images/webapp/images/selectall.js Fri Nov  5
> 16:13:00 2010
> @@ -410,6 +410,12 @@ function setLookDescription(textFieldId,
>       tooltipElement.update(description);
>       lookupWrapperEl.appendChild(tooltipElement);
>   }
> +
> +    // after the description is set; the text field may have been updated
> +    // just in case, call onchange again
> +    if ($(textFieldId).onchange != null) {
> +    $(textFieldId).onchange();
> +    }
> }
>


Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1031655 - /ofbiz/trunk/framework/images/webapp/images/selectall.js

Jacques Le Roux
Administrator
As I suspected it can't be used in the jQuery branch: we get caught in a loop. I have used

// after the description is set; the text field may have been updated
// just in case, call change again
// Only trigger if needed
var events = textField.data('events');
if (events && events.change) {
    textField.change();
}

Jacques

From: "Jacques Le Roux" <[hidden email]>

> Thanks Andrew,
>
> It's quite clear now, I will see what to do in jQuery branch, I guess the same
>
> Jacques
>
> From: "Andrew Zeneski" <[hidden email]>
>> Jacques,
>>
>> When using the auto complete, the value isn't properly set until after
>> the description is parsed. The value field may contain the key and the
>> description until after it is parsed out. The onchange event runs
>> before this happens, so it needs to be called after the string is
>> parsed and placed into the proper fields.
>>
>> That explains why the onchange event is called from here. The reason
>> the onchange event is called in the first place is because these
>> events don't trigger when you set values programmatically only when
>> the value is actually changed by the user (through the browser). So we
>> call the event manually to make sure any listeners are notified.
>>
>>
>> ---
>> Andrew Zeneski
>> [hidden email]
>>
>>
>>
>> ---------- Forwarded message ----------
>> From: "Jacques Le Roux" <[hidden email]>
>> To: <[hidden email]>
>> Date: Sun, 7 Nov 2010 16:49:50 +0100
>> Subject: Re: svn commit: r1031655 -
>> /ofbiz/trunk/framework/images/webapp/images/selectall.js
>> Hi Andrew,
>>
>> I try to understand how and when this is helpful. In other words why
>> did you add this? Could you please give an example?
>> This question because I wonder if I should use it in the jQuery branch.
>>
>> Thanks
>>
>> Jacques
>>
>> From: <[hidden email]>
>> Author: jaz
>> Date: Fri Nov  5 16:13:00 2010
>> New Revision: 1031655
>>
>> URL: http://svn.apache.org/viewvc?rev=1031655&view=rev
>> Log:
>> small change to call the onchange event when updating the autocomplete
>> fields after the description is set
>>
>> Modified:
>>  ofbiz/trunk/framework/images/webapp/images/selectall.js
>>
>> Modified: ofbiz/trunk/framework/images/webapp/images/selectall.js
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/selectall.js?rev=1031655&r1=1031654&r2=1031655&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/images/webapp/images/selectall.js (original)
>> +++ ofbiz/trunk/framework/images/webapp/images/selectall.js Fri Nov  5
>> 16:13:00 2010
>> @@ -410,6 +410,12 @@ function setLookDescription(textFieldId,
>>       tooltipElement.update(description);
>>       lookupWrapperEl.appendChild(tooltipElement);
>>   }
>> +
>> +    // after the description is set; the text field may have been updated
>> +    // just in case, call onchange again
>> +    if ($(textFieldId).onchange != null) {
>> +    $(textFieldId).onchange();
>> +    }
>> }
>>
>
>