Multiple form submits

Hey Guys I have a Livewire project that has great traffic and I am having an issue of then clicking submit button at once and having multiple record duplicates, in essence, it should only be saved once.
Thanks in advance

Hey, @Auzaay

You can disable the button while the user submit the form. Or try to take a look here in this series to let you know how to prevent the duplicate form submission.

Or take a look here to learn how to do it:

Thanks Skywalker actually what i’m looking for is how to refresh parent component from child component after form submission or button click event

Can you share your code?

Product Component

<?php

namespace App\Http\Livewire;

use Livewire\Component;

use App\Product;

use App\User;

class Products extends Component

{

       

    public $products;

    public $amount;

    protected $listeners = [

      'productAdded',

  ];

   

  public function productAdded($productorderId){

    

   $this->products= Product::doesntHave('orders')->where('id',$productorderId)->get();

  }

    public function mount()

    {

      $this->products = Product::doesntHave('orders')->get();

    }

        

    public function render()

    {

        

        return view('livewire.products');

        

    }

}

Child Component

<?php

namespace App\Http\Livewire;

use Livewire\Component;

use App\Order;

use App\Product;

class Orders extends Component

{

  public $product, $period=3, $productId,$order;

  

    public function mount(Product $product)

    {

       $this->product = $product;

     

     $this->order = Order::where('buyer_id', auth()->user()->id)->first();

    }

    

    public function save($productId)

    {

      

      $amount =Product::where('id', $productId)->first()->amount;

      $period =  $this->period;     
    


         

       }

 

      $product= Product::where('id', $productId)->first();   

      $productorder= $product->createOrders([

            'buyer_id' => auth()->user()->id,

            'product_id' =>$this->productId,

            'period' => $this->period,

            'order_amount' =>Product::where('id', $productId)->first()->amount,

           

        ]);

        $this->emit('productAdded', $productorder->id);

 

       

    }

    public function render()

    {

        return view('livewire.orders');

    }

}