[Phpmyadmin-devel] About the AJAXification of the index editor

Rouslan Placella rouslan at placella.com
Thu Jul 7 21:33:24 CEST 2011


On Thu, 2011-07-07 at 23:59 +0530, Thilanka Kaushalya wrote:
> Hi Marc,
> 
> as Rouslan said, please rewrite this function in jQuery, probably
> > passing to it the form name as a parameter. Then move it to
> > js/functions.js.
> >
> > Then you'll be able to call it from tbl_structure.js in your Ajax logic;
> > you'll be able to call this function also from indexes.js at load time.
> >
> > Finally in tbl_indexes.php, instead on the "onchange", use jQuery in
> > indexes.js to bind to changes in select_index_type.
> >
> >
> I did the above mentioned changes and pushed the changes to the repo. Please
> check that. Thank you.

I checked out your branch and it looks good to me (for whatever it's
worth). The only few things that I noticed that might need improvement
are:

* `form_name` in checkIndexName() is misleading as a variable name,
since it will contain the ID of an element (maybe form_id would be
better).

* in checkIndexName() you defined:
  [code] var the_idx_name = $("#input_index_name"); [/code]
  but then you use several times $("#input_index_name") instead of
  the cached `the_idx_name` variable (which BTW should be
  `$the_idx_name` because it's a jQuery object and not an
  arbitrary JS variable).

* You copied an pasted the PHPDOC header from the old version of the
checkIndexName() function, which did not take any arguments, so you are
missing `@param` for the function input.

* [code] the_idx_name.attr("disabled") [/code] will never be undefined
(it's a jQuery object now). Those two times that you are comparing it
against 'undefined' are pointless, so you can just remove those 'if'
statements.

* missing semicolon after 'false' in this code snippet from
functions.js:
[code]
    if ($("#"+form_name).length == 0) {
        return false
    }
[/code]

Hope this helps.

Bye,
Rouslan





More information about the Developers mailing list