You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by gc...@apache.org on 2023/04/25 14:50:53 UTC

[allura] 02/02: fixup! fixup! [#8504] more inline event replacement

This is an automated email from the ASF dual-hosted git repository.

gcruz pushed a commit to branch gc/8504b
in repository https://gitbox.apache.org/repos/asf/allura.git

commit a578117a422e0f94061c6825b8c8da86d3ab776c
Author: Guillermo Cruz <gu...@slashdotmedia.com>
AuthorDate: Tue Apr 25 09:50:32 2023 -0500

    fixup! fixup! [#8504] more inline event replacement
---
 Allura/allura/lib/widgets/forms.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/Allura/allura/lib/widgets/forms.py b/Allura/allura/lib/widgets/forms.py
index 94b99871a..0ac373b2d 100644
--- a/Allura/allura/lib/widgets/forms.py
+++ b/Allura/allura/lib/widgets/forms.py
@@ -261,7 +261,7 @@ class PersonalDataForm(ForgeForm):
                         [ew.Option(py_value=c, label=n, selected=False)
                          for c, n in sorted(list(country_names.items()),
                                             key=lambda k_v: k_v[1])],
-                attrs={'onchange': 'selectTimezone(this.value)'}),
+                ),
             ew.TextField(
                 name='city',
                 label='City of residence',
@@ -334,7 +334,7 @@ class PersonalDataForm(ForgeForm):
         yield ew.JSScript('''
 var $allTimezones = $("#tz").clone();
 var $t = ''' + h.escape_json(dict(country_timezones)) + ''';
-function selectTimezone($country){
+function selectTimeZ($country){
      if($country == " "){
          $("#tz").replaceWith($allTimezones);
      }
@@ -344,7 +344,9 @@ function selectTimezone($country){
              $("#tz").append($("<option></option>").attr("value", value).text(value))
          })
      }
-}''')
+};
+$("select[name='country']").on("change", function(e){ selectTimeZ(e.target.value) });
+''')
 
 
 class AddTelNumberForm(ForgeForm):