Setting a field value

All WYSIWYG Web Builder support issues that are not covered in the forums below.
Forum rules
IMPORTANT NOTE!!

DO YOU HAVE A QUESTION OR PROBLEM AND WANT QUICK HELP?
THEN PLEASE SHARE A "DEMO" PROJECT.



PLEASE READ THE FORUM RULES BEFORE YOU POST:
http://www.wysiwygwebbuilder.com/forum/viewtopic.php?f=12&t=1901

MUST READ:
http://www.wysiwygwebbuilder.com/getting_started.html
WYSIWYG Web Builder FAQ
Post Reply
JohnR
 
 
Posts: 62
Joined: Sat Mar 03, 2018 11:44 pm

Setting a field value

Post by JohnR »

I've done this before, but the mind is slipping.
When I exit a field I want to set another fields value to the value of the field I just exited.
wwonderfull
 
 
Posts: 1440
Joined: Fri Aug 21, 2020 8:27 am
Contact:

Re: Setting a field value

Post by wwonderfull »

Still not clear to be honest. It might take events for sure. Provide a demo of your page if possible.
User avatar
BaconFries
 
 
Posts: 5653
Joined: Thu Aug 16, 2007 7:32 pm

Re: Setting a field value

Post by BaconFries »

Previously asked see Pablos reply on the use of "Conditions"
viewtopic.php?p=463283#p463283
JohnR
 
 
Posts: 62
Joined: Sat Mar 03, 2018 11:44 pm

Re: Setting a field value

Post by JohnR »

This is not necessarily a 'Condition' situation.
I always want field 2 to show the value entered in field1 after field 1 loses focus.
User avatar
BaconFries
 
 
Posts: 5653
Joined: Thu Aug 16, 2007 7:32 pm

Re: Setting a field value

Post by BaconFries »

So let's read this again...what your wanting is this for example user types username in input field1 and then onfocus input field2 username is inserted without retyping? If so see the following for information only.
https://www.plus2net.com/javascript_tut ... a-demo.php
https://jsfiddle.net/2maw8xo4/1/
https://jsfiddle.net/f84shzxu/
wwonderfull
 
 
Posts: 1440
Joined: Fri Aug 21, 2020 8:27 am
Contact:

Re: Setting a field value

Post by wwonderfull »

JohnR wrote: Wed Jun 21, 2023 1:16 pm This is not necessarily a 'Condition' situation.
I always want field 2 to show the value entered in field1 after field 1 loses focus.
Thanks to @bacon I made a script for you : )

Code: Select all

<script>
document.getElementById("field1").addEventListener("blur", function() {
  var x = document.getElementById("field1").value;
  document.getElementById("field2").value = x;
});
</script>
Remember to change your input fields. Paste the code in the HTML tool and do not use any div.
JohnR
 
 
Posts: 62
Joined: Sat Mar 03, 2018 11:44 pm

Re: Setting a field value

Post by JohnR »

Problem resolved - Thanks to all for your replies.
I put a Condition on Field 1 - On Change Calculate Field 2 = [Field 1].
Found that it DOES NOT work if Field 2 has a Floating Label.
Remove the Floating Label and all is right with the world.

Thanks Again!!!
Post Reply