diff options
| author | ivan <ivan> | 2010-04-07 08:15:55 +0000 | 
|---|---|---|
| committer | ivan <ivan> | 2010-04-07 08:15:55 +0000 | 
| commit | 9d69622a6bd83de2add9c2ba9accfe435993bbb1 (patch) | |
| tree | 1b4fd562cb5f489d88944c35afc60fbb7001a442 | |
| parent | c354e082415cd3fe1c48301bd2d5e75af5efedcc (diff) | |
in employee edit, fix form getting submitted before customer search can complete.  throws "status connecting to" error and custnum does not get filled in, RT#8014
| -rw-r--r-- | httemplate/edit/access_user.html | 13 | ||||
| -rw-r--r-- | httemplate/edit/elements/edit.html | 17 | ||||
| -rw-r--r-- | httemplate/elements/search-cust_main.html | 6 | 
3 files changed, 34 insertions, 2 deletions
| diff --git a/httemplate/edit/access_user.html b/httemplate/edit/access_user.html index 1f52b4789..cbced75b1 100644 --- a/httemplate/edit/access_user.html +++ b/httemplate/edit/access_user.html @@ -42,6 +42,8 @@                       '</TR></TD></TABLE>'                       ;                     }, +                 'onsubmit'  => 'check_user_custnum_search', +                 'html_foot' => $check_user_custnum_search,             )  %>  <%init> @@ -49,4 +51,15 @@  die "access denied"    unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); +my $check_user_custnum_search = <<END; +  <SCRIPT TYPE="text/javascript"> +    function check_user_custnum_search(what) { +      while ( user_custnum_search_active ) { +        // javascript needs ambien +      } +      return true; +    } +  </SCRIPT> +END +  </%init> diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index 0c7c02dab..0fc511a17 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -129,6 +129,9 @@ Example:                             "html_string";                           }, +    #javascript function name, will be called with form name as arg +    'onsubmit'   => 'check_form_data', +      #at the very bottom (well, as low as you can go from here)      'html_foot'  => '', @@ -201,7 +204,11 @@ Example:  % my $url = $opt{'post_url'} || popurl(1)."process/$table.html"; -<FORM ACTION="<% $url %>" METHOD=POST NAME="edit_topform"> +<FORM NAME   = "edit_topform" +      METHOD = POST +      ACTION = "<% $url %>" +      <% $opt{onsubmit} ? 'onSubmit="return '.$opt{onsubmit}.'(this)"' : '' %> +>  <INPUT TYPE="hidden" NAME="svcdb" VALUE="<% $table %>">  <INPUT TYPE="hidden" NAME="<% $pkey %>" VALUE="<% $clone ? '' : $object->$pkey() %>"> @@ -699,7 +706,13 @@ Example:  <BR> -<INPUT TYPE="submit" ID="submit" VALUE="<% ( !$clone && $object->$pkey() ) ? "Apply changes" : "Add ". ( $opt{'name'} || $opt{'name_singular'} ) %>"> +<INPUT TYPE     = "submit" +       ID       = "submit" +       VALUE    = "<% ( !$clone && $object->$pkey() ) +                        ? "Apply changes" +                        : "Add ". ( $opt{'name'} || $opt{'name_singular'} ) +                   %>" +>  </FORM> diff --git a/httemplate/elements/search-cust_main.html b/httemplate/elements/search-cust_main.html index 23c4369e8..317922d3c 100644 --- a/httemplate/elements/search-cust_main.html +++ b/httemplate/elements/search-cust_main.html @@ -56,6 +56,8 @@ Example:    } +  var <% $field %>_search_active = false; +    function smart_<% $field %>_search(what) {      var customer = what.value; @@ -128,8 +130,12 @@ Example:        } +      <% $field %>_search_active = false; +      } +    <% $field %>_search_active = true; +      smart_search( customer, <% $field %>_search_update ); | 
