Skip to content

Don't coerce an array to a string for form -> getbutton #115

Description

@stevepiercy

This is madness.

https://github.com/knop-project/knop/blob/master/knop9/knoplibs/knop_form.lasso#L1042-L1054

        local(clientparams = .'clientparams' -> asstring)
        // look for submit buttons, the least destructive first
        with i in array('cancel', 'save', 'add', 'search', 'delete') do => {
            if(#clientparams >> 'button_' + #i
                || #clientparams >> 'button_' + #i + '.x'
                || #clientparams >> 'button_' + #i + '.y') => {
                .'formbutton' = #i
                return #i
            }
        }

coercing the object to a string means that buttons named 'button_saveaddanother' and 'button_savecheckout' both return 'save' for form -> getbutton. The workaround is to insert an arbitrary string that does not much any of the five values in the array.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions