In case anyone's interested...

On Mar 16, 2004, at 1:45 PM, I wrote:

Hello,

I've got the following flowscript:

    function addPromo (text) {
        var row = wid.promos[wid.promos.length];
        row.text.value = text;
        var button = row.deleteButton;
        button.onClick =
            function () {
                // wid.promos.removeRow (0);
                // return;
                var index = button.getParent().getId();
                wid.promos.removeRow (parseInt(index));
            }
    }

Simple repeater, each row has a text field and a "delete" button that deletes the row. It works except for row 0! I can delete all the other rows, but whenever I try to delete the first row, nothing happens.

As a sanity check, I added the 2 lines of code that are commented out above, and then all my buttons do nothing.

This does appear to be a BUG, as far as I can tell. I was able to replicate it in /samples/forms/v2/example with a very minor change to forms_flow_example.js (similar to above: changed the 'removecontacts' onClick handler to just call removeRow(0), and clicking the button after that change does nothing, but if I change the index to 1 it works). So I know this has nothing to do with my repeater, or any other screwyness I may have going on in my application. It just looks like removeRow(0) is broken for some reason.


I worked around by using the predicate form of removeRow:

    function addPromo (text) {
        var row = wid.promos[wid.promos.length];
        row.text.value = text;
        var button = row.deleteButton;
        button.onClick =
            function () {
                wid.promos.removeRow (
                        function (row) {
                            return row == button.getParent();
                        }
                    );
            }
    }

...and that works fine.

~ Mark


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to