Jump to content

Has anyone attempted to use JavaScript to populate a Caspio submission form with data collected from an HTML form?


Recommended Posts

Hi,

You can simply call both the ID of your external submission form and the Caspio submission form and pass the value of each by setting the "value" in JS. 


Example:
 


<-- HTML PART ---> 

	<---- Your embed here ---->
   <script type="text/javascript" src="https://c3abr921.caspio.com/dp/xxxxx/emb"></script>
	<---- Your embed here ---->

    <h1>External Form</h1>
    <form id="externalForm">
        <label for="name">Name:</label>
        <input type="text" id="name" name="name" required><br><br>
        
        <label for="email">Email:</label>
        <input type="email" id="email" name="email" required><br><br>
        
        <label for="age">Age:</label>
        <input type="number" id="age" name="age" required><br><br>
        
        <button type="button" id="populateButton">Populate Caspio Form</button>
    </form>

<-- HTML PART ---> 

<script>
        document.getElementById('populateButton').addEventListener('click', function () {
            const name = document.getElementById('name').value;
            const email = document.getElementById('email').value;
            const age = document.getElementById('age').value;

            // Access the Caspio DataPage elements
            const caspioNameInput = document.getElementById('InsertRecordName');
            const caspioEmailInput = document.getElementById('InsertRecordEmail');
            const caspioAgeInput = document.getElementById('InsertRecordAge');

            // Set the values in the Caspio Submission form
            caspioNameInput.value = name;
            caspioEmailInput.value = email;
            caspioAgeInput.value = age;
        });

    
    </script>



 

Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...