i'm following tutorials trying to reset my password but it doesn't to even open the view in the browser , that's my route :
Route::get('password/email','Auth\PasswordController#getEmail');
Route::post('password/email','Auth\PasswordController#postEmail');
Route::get('password/reset/{token}','Auth\PasswordController#getReset');
Route::post('password/reset','Auth\PasswordController#postReset');
and that's my view
<form method="post" action="password/email" enctype="multipart/form-code">
{!! csrf_field() !!}
<table class="table" style="width:50%; margin:0 auto;">
<tr>
<td colspan="2">
<h1 class="well text-center">Reset Password Form</h1>
</td>
</tr>
<tr>
<td>
Email:<input type="email" name="email" value="{{old('email')}}" />
</td>
</tr>
<tr>
<td>
<button type="submit" class="btn btn-default">Send Password</button>
</td>
</tr>
</table>
</form>
can anyone help me please ?
There's no need to use a tutorial, just run php artisan make:auth to create routes, controllers and views in your application, as described here. Afterwards you can edit the controllers and views as you see fit.
is your views name the same as the view::make in the PasswordController ?
Related
I am quite new to laravel,
Basically, I have this Form where I am showing values Dynamically, and those values i need to pass into controller again for Delete, but not understanding how to do it.
my blade is as bellow
<div class="col-md-12">
#if(isset($rtn_user_id))
#csrf
<table>
<tr>
<td>Customer Name</td> <td>Vechile Name</td> <td>Imei</td><td>Actions</td>
</tr>
<tr>
<td> {{$rtn_user_id}}</td> <td></td> <td> {{$rtn_device_name}}</td> <td>{{$rtn_imei}}</td> <td><button type="button">Delete</button></td>
</tr>
</table>
#endif
</div>
</form>
my operation.delete_imei is like this
so I want to pass the values of $rtn_imei to the controller
public function delete_imei(Request $request)
{
$post_imei = $request->imei;
dd($pos_imei)
}
web.php
Route::post('deleteimei', 'Operation#delete_imei')->name('operation.delete_imei');
Can you please help me with this
You need to issue an HTTP post to /deleteimei, which is really an HTML/JS question, depending on how you choose to do it.
Assuming you're not using a JS library which makes life easier, this is how you'll want to do it (change the selectors etc. to suit):
document.getElementsByTagName('button').click = function() {
xhttp.open('POST', '/deleteimei', true);
xhttp.send();
location.reload();
}
In Blade File
#csrf
#if(isset($rtn_user_id))
<tr>
<td>Customer Name</td> <td>Vechile Name</td> <td>Imei</td><td>Actions</td>
</tr>
<tr>
<td> {{$rtn_user_id}}</td> <td></td> <td> {{$rtn_device_name}}</td> <td>{{$rtn_imei}}</td> <td><button formaction="{{route('operation.delete_imei',$rtn_imei)}}" type="submit" class="btn btn-danger btn-sm"><i class="fa fa-trash-o" aria-hidden="true"></i></button></td>
</tr>
</table>
#endif
</div>
</form>
web.php
Route::delete('deleteimei/{id}', 'Operation#delete_imei')->name('operation.delete_imei');
-In Operation Controller
public function delete_imei($id) {
$post_imei = $id;
dd($pos_imei)
$data=DB::delete('delete from delete_imei where id=?',[$id]);
return redirect(route('index'));
}
i think you should edit your blade like this and this will send your form's data to your controller and you will be suitable for get your request's datas.
<form role="form" method="POST" action="{{ route('operation.delete_imei') }}">
#csrf
<div class="col-md-12">
#if(isset($rtn_user_id))
<table>
<tr>
<td>Customer Name</td> <td>Vechile Name</td> <td>Imei</td><td>Actions</td>
</tr>
<tr>
<td> {{$rtn_user_id}}</td> <td></td> <td> {{$rtn_device_name}}</td> <td>{{$rtn_imei}}</td> <td><button type="button">Delete</button></td>
</tr>
</table>
#endif
</div>
</form>
if you want to pass some data from blade to controller just put some hidden input in your form and set the value of that with your data you want to pass:
<input id="invisible_id" name="invisible" type="hidden" value="{{$data}}">
I want to fill a list of applications for a university in the frontend. Each entry is supposed to hold two buttons: one for accepting the application and one for rejecting it. I created one form for each submit-button each.
<div class="container">
<div class="row">
<div class="col-12">
<table class="table table-hover">
<thead>
<tr>
<th scope="col"></th>
<th scope="col">Firstname</th>
<th scope="col">Lastname</th>
<th scope="col">Grade</th>
<th scope="col">NC</th>
<th scope="col">Course</th>
<th scope="col">Certificate</th>
<th scope="col">Recommendation</th>
<th scope="col">Decision</th>
</tr>
</thead>
<tbody>
<tr th:each="applicationOpen, rowStat: ${lstOpApplications}">
<th th:text="${rowStat.count}">1</th>
<td th:text="${applicationOpen.firstname}">firstname</td>
<td th:text="${applicationOpen.lastname}">lastname</td>
<td th:text="${applicationOpen.highschool_grade}">grade</td>
<td th:text="${applicationOpen.nc}">nc</td>
<td th:text="${applicationOpen.name}">coursename</td>
<td th:text="${applicationOpen.highschool_certificate}">certificate</td>
<td th:text="${applicationOpen.document}">recommendation</td>
<td>
<form action="#" th:action="#{/Bewerberubersicht}" th:object="${decisionForm}" method="post">
<input type="hidden" name="application_id" th:field="*{application_id}" value=${applicationOpen.id}"/>
<input type="hidden" name="decision" th:field="*{decision}" value=1/>
<button type="submit" class="btn btn-success"><i class="fas fa-edit"></i>Accept</button>
</form>
<form action="#" th:action="#{/Bewerberubersicht}" th:object="${decisionForm}" method="post">
<input type="hidden" name="application_id" th:field="*{application_id}" value=${applicationOpen.id}/>
<input type="hidden" name="decision" th:field="*{decision}" value=2/>
<button type="submit" class="btn btn-danger"><i class="fas fa-edit"></i>Reject</button>
</form>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
When I look in the Browser's Dev-Tools I can see that the content of the POST-request is
application_id: ""
decision: ""
When I replace value=${applicationOpen.id} with e.g. value=5 it is still empty. Hence, it should not be a problem with applicantOpen. Also, the list in the frontend is being filled just fine, so all of that should work. I first thought is is a problem with the DecisionForm class, but it seems my subsequent problems are caused by the issue described here.
The th:field attribute overrides content of name and value attributes. The decisionForm object seems to have empty fields so all forms have empty values.
Basically using th:object with th:field is convenient when you need to have your form prepopulated with values. It establishes initial state of your form, not the target. Using them makes sense for single form, not for multiple forms in loop with varying values.
In your case: please remove both th:object and th:field attributes. Instead use value="1" or value="2" for decision input, and th:value="${applicationOpen.id}" for application_id input.
Can anyone explains me, why the submit buttons no and yes in the following code not trigger?
Without the table, it works.
<table class="table">
<thead>
<tr>
<th scope="col">Group</th>
<th scope="col">Yes No</th>
</tr>
</thead>
#foreach($invitations as $invitation)
{!! Form::open(array('route'=>'store.groupentry')) !!}
<tbody>
<tr>
<td>
Do you want to enter group {{$invitation->group_name}}?
</td>
<td>
<input type="hidden" name="idgroup" value="{{ $invitation->idgroup }} "/>
<input type="hidden" name="groupname" value="{{ $invitation->group_name }} "/>
<button type="submit" class="btn btn-default" name = "submitbutton" value = "save">Yes</button>
<button type="submit" class="btn btn-default" name = "submitbutton" value = "nosave">No</button>
{{ csrf_field() }}
</td>
</tr>
</tbody>
{!! Form::close() !!}
#endforeach
</table>
Maybe not valid html generation. You generate many forms wrap many tbody in one table. I think you need create one form, and before submit set hidden values with js
I just learned about parsley.js and I'm trying to add it's validation capabilities to my project that is already wired up with knockout.js bindings. Here is the markup:
<form id="form-add-gift" data-bind="submit: addGift" data-validate="parsley">
<table class="table table-striped">
<thead>
<tr>
<th>Gift</th><th>Description</th><th>Url</th><th></th>
</tr>
</thead>
<tfoot>
<tr>
<td><input id="txtName" name="txtName" type="text" data-required="true" data-bind="value: newGift().name" /></td>
<td><input id="txtDescription" name="txtDescription" type="text" data-bind="value: newGift().description" /></td>
<td><input id="txtUrl" name="txtUrl" type="text" data-type="url" data-bind="value: newGift().url" /></td>
<td><button id="btnAdd" name="btnAdd" class="btn" type="submit" data-bind="disable: newGift().name.length > 0">Add gift</button></td>
</tr>
</tfoot>
<tbody data-bind="foreach: gifts">
<tr>
<td id="tdName" data-bind="text: name"></td>
<td id="tdDescription" data-bind="text: description"></td>
<td id="tdUrl" data-bind="text: url"></td>
<td><a id="btnRemove" class="btn btn-danger" href="#" data-bind="disabled: $parent.isClaimed, click: $parent.removeGift">Remove</a></td>
</tr>
</tbody>
</table>
</form>
When I click the "Add gift" button, my knockout.js addGift() function fires and the parsley.js validation occurs afterward. Obviously this is incorrect. Is there any way to get parsley.js to play nice with the knockout.js bindings?
I don't think parsley.js meant to work directly with KnockoutJs, but this can't stop you from using them both nicely.
Quick look through the Documentation -> Javascript - > Form you can use this method:
$('#form').parsley('isValid');
Useful if you want to integrate the form validation process inside
custom functions, without triggering error messages.
UPDATE
you can try this too:
$( '#form' ).parsley( 'validate' );
Useful if you want to integrate the form validation process inside
custom functions.
Hi I created an php website which uses for AJAX post and was live at http://sprook.com.au/ but my client change it's domain to http://www.sprookit.net/ from his service provider Godaddy and now the firebug says:
Permission denied to access property 'stopAjax'
here stopAjax is my method name.
script is there:
<div class="post_area">
<form action="post.php" method="post" id="addVideo" enctype="multipart/form-data" target="post" onsubmit="return startAjax(this);">
<iframe id="post" name="post" src="#" style="width:0;height:0;border:0px solid #fff;"></iframe>
<table width="860" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="435">POST YOUR AD FREE<br />
<em>Paste embed code from YouTube</em></td>
<td width="322"><input type="text" id="videoLink" name="videoLink" class="input_textbox" />
</td>
<td width="95"><input type="submit" name="set_video_link" id="set_video_link" value="" class="submt_post" />
</td>
</tr>
<tr>
<td> </td>
<td><div id="process"> Connecting please wait <img src="images/loading.gif" /><br/>
</div></td>
</tr>
</table>
</form>
</div>
And all content comes from old domain i removed index file and it stoped working, therefore it is cleared that scripts run from old domain.
Most likely you're running into same origin policy issue here as both script and iframe domain must match. You need to verify that all content really comes from new domain and not the old one.