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

allow the method argument in buttonTo view helper #761

Closed
chapmandu opened this Issue Apr 10, 2017 · 6 comments

Comments

5 participants
@chapmandu
Member

chapmandu commented Apr 10, 2017

When trying to use:

#buttonTo(text="Delete", route="thingDelete", key=thing.key(), method="delete")#

Wheels throws the following exception:
Wheels.IncorrectArguments
The method argument cannot be passed in since it will be set automatically by Wheels.

Workaround is to implement the form:

#startFormTag(route="thingDelete", key=thing.key(), method="delete")#
    #submitTag(value="Delete")#
#endFormTag()#

@perdjurner perdjurner added this to the 2.0.0 milestone Apr 10, 2017

@andybellenie

This comment has been minimized.

Contributor

andybellenie commented Apr 10, 2017

@chapmandu

This comment has been minimized.

Member

chapmandu commented Apr 10, 2017

With coldroute built into the core, I want to be able to use the buttonTo helper to use the pseudo delete method.

@neokoenig

This comment has been minimized.

Member

neokoenig commented Apr 10, 2017

I thought it was meant to be _method ?

@chapmandu

This comment has been minimized.

Member

chapmandu commented Apr 10, 2017

No, it should be method as can be used with startFormTag(method="delete"...) which renders the markup:

<form action="/things/123" method="post">
    <input id="_method" name="_method" value="DELETE" type="hidden">
</form>
@chapmandu

This comment has been minimized.

Member

chapmandu commented Apr 10, 2017

@chapmandu chapmandu closed this Apr 10, 2017

@chrisdpeters

This comment has been minimized.

Contributor

chrisdpeters commented Apr 10, 2017

Very nice. I'll have to update the linking docs to use this method because it is much nicer than what I have in there right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment