Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
stevepiercy opened this issue Jul 21, 2015 · 0 comments
Open

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

stevepiercy opened this issue Jul 21, 2015 · 0 comments

Comments

@stevepiercy
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant