Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please give us an example of how to do it with Next.JS app router? #3

Open
dBianchii opened this issue Jul 25, 2023 · 2 comments
Open

Comments

@dBianchii
Copy link

No description provided.

@dBianchii
Copy link
Author

Pretty please

@thallysondias
Copy link

thallysondias commented Sep 25, 2024

@dBianchii

Campos disponivéis:
https://developers.rdstation.com/reference/patch_platform-contacts-identifier-value

`
"use client";
import React, { useEffect, useState } from "react";

const SimpleForm = () => {
const [name, setName] = useState("");
const [email, setEmail] = useState("");
const [job, setJob] = useState("");

// Adiciona o script de monitoramento do RD Station quando o componente é montado
useEffect(() => {
const script = document.createElement("script");
script.src = "https://d335luupugsy2.cloudfront.net/js/loader-scripts/XXXXXXXXXXX-loader.js"; // Substitua pelo seu script RD Station
script.async = true;
document.body.appendChild(script);
}, []);

const handleSubmit = (e: any) => {
// Não usamos preventDefault, para permitir que o RD Station capture o evento de submissão
console.log("Submetendo formulário para o RD Station:", { name, email, job });
};

return (




Nome:
<input
type="text"
id="name"
name="name"
value={name}
onChange={(e) => setName(e.target.value)}
placeholder="Digite seu nome"
required
className="border border-gray-300 rounded-md p-2"
/>

    </div>
    <div>
      <label htmlFor="job_title">Job:</label>
      <input
        type="text"
        id="job_title"
        name="job_title"
        value={job}
        onChange={(e) => setJob(e.target.value)}
        placeholder="Digite seu cargo"
        required
        className="border border-gray-300 rounded-md p-2"
      />
    </div>
    <div>
      <label htmlFor="email">Email:</label>
      <input
        type="email"
        id="email"
        value={email}
        onChange={(e) => setEmail(e.target.value)}
        placeholder="Digite seu email"
        required
        className="border border-gray-300 rounded-md p-2"
      />
    </div>
    <div>
      <button type="submit" className="bg-blue-500 text-white px-4 py-2 rounded-md">
        Enviar
      </button>
    </div>
  </form>
</div>

);
};

export default SimpleForm;
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants