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

allow the method argument in buttonTo view helper #761

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

allow the method argument in buttonTo view helper #761

chapmandu opened this issue Apr 10, 2017 · 6 comments
Assignees
Milestone

Comments

@chapmandu
Copy link
Contributor

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
Copy link
Contributor

andybellenie commented Apr 10, 2017 via email

@chapmandu
Copy link
Contributor Author

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

@neokoenig
Copy link
Contributor

I thought it was meant to be _method ?

@chapmandu
Copy link
Contributor Author

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
Copy link
Contributor Author

4838bcf

@chrisdpeters
Copy link
Contributor

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants