#414 Auto complete does not work for foreign key constraints

5.0.3
pending-fixed
Robert Treat
Constraints (3)
5
2012-11-28
2011-10-09
Brandon Phelps
No

When a foreign key constraint exists and you are inserting a record from the web gui, selecting an option from the popup inserts "<div style="text-align: right; background-color: rgb(61, 128, 223); color: rgb(255, 255, 255);">ID</div>" into the input box instead of just the ID. This obviously results in an SQL query if you submit.

Using Firefox 7.0.1 and PostgreSQL 9.1 with phpPgAdmin 5.0.3.

Discussion

  • Brandon Phelps
    Brandon Phelps
    2011-10-10

    • labels: --> Constraints
     
  • Victor Popov
    Victor Popov
    2011-10-26

    Quick fix, not sure if it is absolutely correct:
    replace occurence of "InnerHTML" text in file js/ac_insert_row.js (there is only one such) with "innerText".

    With context: replace string
    jQuery('input[name="values['+ a[i].name +']"]').val(a[i].innerHTML);
    with
    jQuery('input[name="values['+ a[i].name +']"]').val(a[i].innerText);

     
  • Xiguang Wang
    Xiguang Wang
    2011-11-10

    I've tryed vicpopov's patch and it does work.

    Not found any other problem caused by the patch yet.

     
    • assigned_to: nobody --> ioguix
     
  • Hello,

    Thank you for the report, patch proposal and feedback !

    I'll try to review / commit this as soon as possible, probably on next week.

     
  • woodz
    woodz
    2012-01-14

    Hi guys,
    I was digging a bit deeper since I absolutely want that feature working well. I found out that the provided solution from vicpopov does not work for Mozilla Firefox. You can check http://www.davidtong.me/innerhtml-innertext-textcontent-html-and-text/. They link to the dom/w3c and there is a cross browser replacement given:

    var text = x.innerText || x.textContent;

    FF does not know about innerText, it just knows textContent. By the way I do not understand why the funky browser manufacturers can't have a standard between in 2012?

    So I suggest to extend our workaround to:

    With context: replace string
    jQuery('input[name="values['+ a[i].name +']"]').val(a[i].innerHTML);
    with
    jQuery('input[name="values['+ a[i].name +']"]').val(a[i].innerText || a[i].textContent);

    Die-hard ppa developers may consider the further workarounds mentioned under the resource above, especially when keeping white spaces is required when doing inline editing.

    Good night

     
  • Hey,

    Thank you for reviving this bug...

    I'm currently pretty almost alone "working" on PPA on my free time right now and I have so much to do with the plugin arch presently.

    Anyway, I'll try to fix this bug in our current dev tree as soon as possible...

    Cheers!

     
  • Nate Bessette
    Nate Bessette
    2012-06-27

    Just ran into this bug, quite annoying. jQuery will handle this for you:

    jQuery('input[name="values['+ a[i].name +']"]').val(jQuery(a[i]).text());

     
  • Robert Treat
    Robert Treat
    2012-11-28

    • assigned_to: ioguix --> xzilla
     
  • Robert Treat
    Robert Treat
    2012-11-28

    • status: open --> pending-fixed