clear form on submit
This commit is contained in:
		
							parent
							
								
									29b09848b0
								
							
						
					
					
						commit
						533398cdb3
					
				@ -22,20 +22,24 @@ export default function CreateCountryForm() {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  }, [formState.message]);
 | 
					  }, [formState.message]);
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <form action={formAction} className="flex flex-col gap-2">
 | 
					    <form ref={formRef} action={formAction} className="flex flex-col gap-2">
 | 
				
			||||||
      <Input
 | 
					      <div className="flex items-center gap-2">
 | 
				
			||||||
        name="name"
 | 
					        <Input
 | 
				
			||||||
        id="name"
 | 
					          name="name"
 | 
				
			||||||
        className={clsx({ "border-red-500": formState.errors?.name })}
 | 
					          id="name"
 | 
				
			||||||
      />
 | 
					          className={clsx({ "border-red-500": formState.errors?.name })}
 | 
				
			||||||
      {formState.message === "success" ? (
 | 
					        />
 | 
				
			||||||
        <Check className="text-green-400" />
 | 
					        {formState.message === "success" ? (
 | 
				
			||||||
      ) : (
 | 
					          <Check className="text-green-500" />
 | 
				
			||||||
        <div className="flex items-center gap-2">
 | 
					        ) : (
 | 
				
			||||||
          <CircleX className="text-red-600" />
 | 
					          ""
 | 
				
			||||||
          <span>{formState.errors?.name}</span>{" "}
 | 
					        )}
 | 
				
			||||||
        </div>
 | 
					        {formState.message === "error" ? (
 | 
				
			||||||
      )}
 | 
					          <CircleX className="text-red-500" />
 | 
				
			||||||
 | 
					        ) : (
 | 
				
			||||||
 | 
					          ""
 | 
				
			||||||
 | 
					        )}
 | 
				
			||||||
 | 
					      </div>
 | 
				
			||||||
      <SubmitButton text={"Country"} />
 | 
					      <SubmitButton text={"Country"} />
 | 
				
			||||||
    </form>
 | 
					    </form>
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user