Adding form action in html in laravel

You can use the action() helper to generate an URL to your route: <form method=”post” action=”{{ action(‘WelcomeController@log_in’) }}” accept-charset=”UTF-8″> Note that the Laravel 5 default installation already comes with views and controllers for the whole authentication process. Just go to /home on a fresh install and you should get redirected to a login page. Also … Read more

Clear form after submission with jQuery

You can add this to the callback from $.post $( ‘#newsletterform’ ).each(function(){ this.reset(); }); You can’t just call $( ‘#newsletterform’ ).reset() because .reset() is a form object and not a jquery object, or something to that effect. You can read more about it here about half way down the page.

Wrapping a FormControl in Angular (2+)

Edit: I’ve added a helper for doing just this an angular utilities library I’ve started: s-ng-utils. Using that you can extend WrappedFormControlSuperclass and write: @Component({ selector: ‘my-wrapper’, template: ‘<input [formControl]=”formControl”>’, providers: [provideValueAccessor(MyWrapper)], }) export class MyWrapper extends WrappedFormControlSuperclass<string> { // … } See some more documentation here. One solution is to get the @ViewChild() corresponding … Read more

Get element by part of Name or ID

Your best bet is probably document.querySelectorAll, which you can use any CSS selector with, including an “attribute starts with” selector like input[id^=”id_qtedje_”]. It’s supported on all modern browsers, and also IE8: var elements = document.querySelectorAll(‘input[id^=”id_qtedje_”]’); If you wanted just the first match (rather than a list), you could use document.querySelector instead. It returns a reference … Read more