Laravel: How to use destroy with html forms - laravel-5

So since the form helpers arent included in laravel anymore. How do we call for a delete method with regular html forms? I can't find nothing about this, every example uses the form helpers..
thanks
Edit: It works using this:
<input name="_method" type="hidden" value="DELETE">
However, a little bit of explanation would be nice.

Related

WIX: Add custom HTML or my own form (to another website)

I need to create a form that by clicking on it will redirect to another website with special 'inputs' tags values.
something like:
<form action="http://example.com" method="post">
<input type="hidden" name="val1" value="something">
<input type="hidden" name="val2" value="else">
<input type="submit" name="submit" value="Go">
</form>
The custom HTML feature that I find will put it inside an iframe, and it looks bad. Is there a way to do it that will look 'normal'?
If you utilize Wix Code you can develop that inside your Wix page without the need of any html forms.
Simple solution:
- Add the form input elements you need on your page
- Add a button to click on
- Add av event handler to the button and grab the values from the input fields
- Send that data to any site or redirect the user to the site you want using wixLocation.to("url") with the query parameters you might need from the form.

CS CART call a controller at add on front end with microformat ajax

I am very new to cs cart. I have read their documentation about calling Ajax with form micrformats. I am able to create a Ajax request. But I would like to call a controller inside my add-on controllers/frondend/ directory names as mycheckout.php. I am using the a hidden file dispatch with the valu mycheckout.mymode. Can any one help me. I actually want to perform some action in my controller. But their documentation did not help me. Thanks in advance.
You can do something like this (use extra "cm-ajax-force" or "cm-ajax-full-render" classes if needed):
<form class="cm-ajax" name="your_name" action="{""|fn_url}" method="post">
<input type="hidden" name="result_ids" value="div_id_to_be_updated" />
{include file="buttons/go.tpl" but_name="mycheckout.mymode" alt=__("Ajax button")}
</form>
Or you can use any button you want (even <input type="submit" name="mychechkout.mymode" value="Ajax!">)
Note that the Ajax request can be also done via simple link:
<a class="cm-ajax cm-post" href="{"mycheckout.mymode?param1=value1&param2=value2"|fn_url}" data-ca-target-id="div_id_to_be_updated">Ajax!</a>

AngularJS : ng-model in ng-repeat

I m beginer in AngularJS, and i try to do this :
<form ng-repeat="prop in tab">
<input ng-model="prop" type="text">
</form>
{{tab}}
With this code inputs values is ok, but when i edit value the reverse binding to "tab" don't work.
How i can simply do this ?
Thanks for yours tips ;)
If you want to see changes in your html document live you either need to move the expression inside the form tag and change it to {{tab.prop}} or outside the tag but also showing the property you are interested in displaying such as {{tab.somePropertyName}}.

Laravel 5: put, patch and delete requests without using Form builder

Since in Laravel 5 the form builder class is absent (you can add it, I know), how can I make put, patch and delete requests to match those routes without using any form builder class, just plain Laravel?
You should try adding:
<input name="_method" type="hidden" value="DELETE">
to your form. This is what Form generator do in Laravel 4 - it simply adds hidden input with name _method.
Of course for DELETE value in above example you can put any other methods

How to Use JavaScript instead of Custom HTML Attributes for Angular Forms?

Considering this example markup (from http://www.ng-newsletter.com/posts/validations.html):
<div class="row">
<div class="large-12 columns">
<label>Your name</label>
<input type="text"
placeholder="Name"
name="inputNameAttributeValue"
ng-model="signup.name"
ng-minlength=3
ng-maxlength=20 required />
<div class="error"
ng-show="signup_form.name.$dirty && signup_form.name.$invalid">
<small class="error"
ng-show="signup_form.name.$error.required">
Your name is required.
</small>
<small class="error"
ng-show="signup_form.name.$error.minlength">
Your name is required to be at least 3 characters
</small>
<small class="error"
ng-show="signup_form.name.$error.maxlength">
Your name cannot be longer than 20 characters
</small>
</div>
</div>
</div>
Is there a way to accomplish the same thing, but use JavaScript instead of custom Angular attributes?
For example, is there a way I can use JavaScript instead of these Angular html attributes: ng-model, ng-minlength, ng-maxlenth, ng-show?
EDIT:
Just to clarify, I'm looking for a solution that uses the Angular JavaScript API. I would like to have a separate JavaScript document (linked from my HTML document) that uses the Angular JavaScript API. For example, is there a way to specify ng-model for a particular form field using the Angular API instead of the custom Angular HTML attribute?
As I understand it, you want to add a directive (for example ng-model) from javascript, similar to how you would do it with jQuery. Short answer: Don't do it.
Longer Answer: It's probably technically possible, but it would violate the basic principles of AngularJS. Your controller should not touch the HTML at all, in fact any code which should directly manipulate the HTML should be placed in a directive. And that directive should be placed on the input directly in your HTML, which is exactly what you wanted to avoid.
If placing directives in your HTML is not practical for your project, then perhaps you should reconsider using AngularJS.
There's a rather long (and well written) answer here on Stackoverflow which explains "how to think in AngularJS", you might find that it's of interest: https://stackoverflow.com/a/15012542/179024
It would also be interesting to know why you want to do this? There is often an "Angular way" of doing things, but it can be different from what we are used to doing.

Resources