sitekey error present on standard Netlify form - recaptcha

I've added the data-netlify-recaptcha tag to my form and created an empty div with the same tags in my Netlify form and I keep seeing this error: "netlify Missing required parameters: sitekey".
I'm using the basic reCAPTCHA 2 challenge instructions from Netlify and I'm not adding a custom one so why is this error popping up?
heres the form:
<form
name="contact-form"
method="POST"
data-netlify="true"
netlify-honeypot="bot-field"
data-netlify-recaptcha="true"
>
...
<div data-netlify-recaptcha="true"></div>
</form>
Any help would be appreciated.
Thanks.

Related

Laravel 8 Livewire wire:click:prevent Not Working

Please Someone please I am in the middle of my final year project but this is not working I am trying for 3 days I am new so I don't know how to ask a question so if you need something please ask me Thanks
This is the view for Shop and i have used Composer require Hardevine/shoppingcart
This is the ShopComponent for Shop
When I ran Laravel 8 on IIS, I had a similar problem. The problem was that the browser couldn't access some of the livewire js files, and the solution was:
Go to D:\Projects\Laravel\laravel8ecommerce\vendor\livewire\livewire\config\livewire.php
and set
'asset_url' => "your_url",
and the problem was disappeared.
I had same problem. To solve this issue what I did was enclose my blade template files with a <div> containing an id="main" like so:
<div id="main">
your blade template code
<div>
Instead Of This
wire:click:prevent=“store({{$product->id}},’{{$product->name}}’,{{$product->regular_price}})”
You need to use this in your blade file
#livewireStyles
your code will be in this area
#livewireScripts
Try This For Calling Store Function
wire:click.prevent="store({{$product->id}},{{$product->name}},{{$product->regular_price}})”
Or
wire:click="store({{$product->id}},{{$product->name}},{{$product->regular_price}})”
My solution was based on #KumTem answer
Inside the livewire blades located at app\resources\views\livewire\sample_blade.php
<div id="main">
... templates here
</div>

Laravel API route - exception: "Symfony\Component\HttpKernel\Exception\NotFoundHttpException"

I'm making a Blog for school on my portfolio website, now I'm doing this in VueJS and Laravel and for this I need API routes.
Now I want to delete a comment with a specific ID but when I push the delete button it gives the error:
exception: "Symfony\Component\HttpKernel\Exception\NotFoundHttpException"
The error is in the {routeCommentID} part of the next route:
Route::post('/deleteComment/{routeCommentID}', 'CommentController#delete');
What did I do wrong? Because when I remove that it works fine, but I need this part because I have to remove a comment with a specific ID.
Run php artisan route:list and check if route like '/deleteComment/{routeCommentID}' exists and whether you use that route in your Vue application.
for deleting a post it's better to use
Route::delete('/deleteComment/{id}', 'CommentController#delete');
and checkout your blade for deletion
it should be something like below
<form action={{ 'wanted route' }} method="post">
#csrf
#method('delete')
// your code
</form>

CSRF error in laravel

I have a problem in Laravel . when over and over submit Form with post method and somtimes I get error and see expire error that related to CSRF
anybody knows how can I manage this error that display not in site and instead of redirect to any page else ?
Laravel makes it easy to protect your application from cross-site request forgery (CSRF).
Just add #csrf blade directive inside the form to avoid getting csrf token error.
<form method="POST" action="/profile">
#csrf
...
</form>
The directive puts something like this
<input type="hidden" name="_token" value="CzK6peomC6Pnnqdm4NsxpdGSH6v1evDnbN12oL" >
Read more about it in the laravel documentation here https://laravel.com/docs/5.6/csrf
Regarding the expiration of the token I think you might want to handle the error this way https://gist.github.com/jrmadsen67/bd0f9ad0ef1ed6bb594e
Also, there's a package which helps the forms keep awake.
https://github.com/GeneaLabs/laravel-caffeine
I hope that helps.
Laravel 5 using Blades templates, it's easy.
Add csrf toke in your blade file
{{ csrf_token() }}
If you are using Laravel 5.6 then you need to add something like this in your code of the form
#csrf
Check in detail about: CSRF Laravel

Using <script> tag AJAX method in GAS

I am trying to implement a Stripe payment solution on my Google Site using Google Apps Script (“GAS”) and Stripe.com.
Stripe makes the following code available for testing.
<div>
<form action="/charge" method="POST">
<script
src="https://checkout.stripe.com/checkout.js"
class="stripe-button"
data-key="pk_test_6pRNASCoBOKtIshFeQd4XMUh"
data-image="/square-image.png"
data-name="Demo Site"
data-description="2 widgets ($20.00)"
data-amount="2000">
</script>
</form>
</div>
The code works here on jsfiddle but fails in my GAS index.html file.
Note that when I look inside my Console page in my Chrome developer tools, I see the following error message:
TypeError: Cannot read property 'StripeCheckout' of undefined
What’s going wrong? And what’s the solution?

how to send file data using Dajaxice?

I am using ajax for my website. I have successfully used jQuery.ajax() to asynchronously upload file to server. I am using Dajax and Dajaxice therefore I plan to use these application for file upload as well. I tried this example. It is working fine. But if I add file field into my html form, it does not send file to server. My html form looks like
<form id="myform" action="/file/" method="post" enctype="multipart/form-data">
<div style='display:none'><input type='hidden' name='csrfmiddlewaretoken' value='AaSmyBEwQLSD3YghRAD9Cf2uxEjzESUe' /></div>
<p><label for="id_docfile">Select a file</label> max. 42 megabytes</p>
<p><input type="file" name="docfile" id="id_docfile" /></p>
<p><input type="submit" value="Upload" /></p>
</form>
This question has been asked at many place but never answered.
Afaik there is currently no provision within dajax / dajaxice to upload files.
I have used dajax in a few projects and have got round this by using blueimp/jquery-file-upload and a django view that accepts a POST of the upload file and return a JSON string to the client.
This is a less than perfect solution not least because the jquery-file-upload button is styled differently from normal html form elements, it is possible to style the whole form using jQuery-ui, although this is a lot of additional work.
Both, dwr which is pretty much dajax for Java, and tasty pie for django do offer file uploading, so in theory it should be possible to implement it.
I'm happy to post a sample of my ajax solution if anyone would find them useful.
I've also faced this problem recently. So, I've digged a little and discovered some answers.
It is working fine. But if I add file field into my html form, it does not send file to server.
There's serialize() method used in the doc example. But according to the jQuery doc:
Data from file select elements is not serialized.
Also, there's no clear way to get ajax file upload, because JS doesn't have access to the outside of the client browser. So, I don't think it's possible to make using dajaxice.
The easiest hack, I've found is to post form to the invisible iframe using target option:
<form method='POST' action='/upload' enctype='multipart/form-data' target='submit-iframe'>
so, only the iframe will be refreshed. Using js you than can get data from it catching the load() event.
More detailed process described here

Resources