cflapt Posted November 17, 2013 Report Share Posted November 17, 2013 Hi, I am trying to implement the following function into a details datapage: Text Box 1 - user types in data Text Box 2 - user clicks button and Text Box 1 data is copied into Text Box 2 I have found javascript that makes this work with a checkbox, but I would like a button. I found javascript for a button but it doesn't seem to work within the datapage for some reason. Here is the button javascript I found. One problem is that the button html below trys to submit the page. <script>function onSubmitClick() {var box1 = document.getElementById('box1');var box2 = document.getElementById('box2');box2.value = box1.value;}</script><textarea id='box1'></textarea><textarea id='box2'></textarea><button onclick='onSubmitClick(); return false'>Click Me</button> Quote Link to comment Share on other sites More sharing options...
MayMusic Posted November 21, 2013 Report Share Posted November 21, 2013 Do you have the link to the page? You can out an alert in the function to see when you click on button it calls the function or not function onSubmitClick() { var box1 = document.getElementById('box1');var box2 = document.getElementById('box2');box2.value = box1.value;} Quote Link to comment Share on other sites More sharing options...
cflapt Posted November 27, 2013 Author Report Share Posted November 27, 2013 I got it to work. For some reason I only get the problem if I test the code through Chrome html editor. When I actually deploy the datapage it works. Thanks for the help. One more question, I have datapage#1 with an iframe that contains datapage#2. I would like a button on datapage#1 that copies a field from datapage#2 and pastes the data within a field on datapage#1, ie., the exact same thing as the above code only across the iframe barrier. Do you know how to tweak the above code to accomplish such a function? Thanks again, I appreciate your help! Quote Link to comment Share on other sites More sharing options...
MayMusic Posted December 4, 2013 Report Share Posted December 4, 2013 You can send the value of the fields through the link of the iframe and receive them in the second page. Quote Link to comment Share on other sites More sharing options...
Kurumi Posted February 4, 2022 Report Share Posted February 4, 2022 Sharing this post: Or you may use Calculated Value on this case: https://howto.caspio.com/datapages/datapage-components/calculated-values/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.