Jump to content
  • 0
ManonG

Copy dropdown value to text field

Question

3 answers to this question

Recommended Posts

  • 0

Hi @ManonG,

You can use the following script in Datapage Footer:

<script type="text/javascript">
document.addEventListener('DataPageReady', function (event) {
	document.querySelector('[id*=InsertRecord*YOUR_DROPDOWN_FIELD*]').addEventListener('change', function() {
        let item = document.querySelector("select[id='InsertRecord*YOUR_DROPDOWN_FIELD*']").value;
        document.querySelector("input[id='InsertRecord*YOUR_TEXT_FIELD*']").value = item;   
    });
});
</script>

Please note that this JS code designed for Submission Form Datapage. Also, make sure you disable HTML editor and change *YOUR_DROPDOWN_FIELD* & *YOUR_TEXT_FIELD* to your actual field names.

Hope this helps.

Regards,

vitalikssssss

Share this post


Link to post
Share on other sites
  • 0

Hi Vitalikssssss.

Thank you for answering my question quickly.
However as I don't know Javascript could you make me a simpler example with only 2 fields either :  
InsertRecordIdIdee_4231fb6d798953 (Dropdown)
InsertRecordTitre (Text)

Thank you. Thank you. 
Manon

 

 

Share this post


Link to post
Share on other sites
  • 0
<script type="text/javascript">
document.addEventListener('DataPageReady', function (event) {
	document.querySelector('[id*=InsertRecordIdIdee]').addEventListener('change', function() {
        let item = document.querySelector("select[id='InsertRecordIdIdee']").value;
        document.querySelector("input[id='InsertRecordTitre']").value = item;   
    });
});
</script>

@ManonG, using @Vitalikssssss example with your field IDs, I believe this is the script you are looking for.

Share this post


Link to post
Share on other sites

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
Answer this question...

×   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...