Hi Pablo,
I am using Version 15. I want to clear only few fields in my form when a selection is selected? For example when the user select "No", then I want information in fields 1 and 2 only to be cleared. Please help me. Thanks.
Clear form field
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
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
- BaconFries
-
- Posts: 5642
- Joined: Thu Aug 16, 2007 7:32 pm
Re: Clear form field
This will require a custom script such as javascript. Please note WB15 is no longer supported....
Re: Clear form field
here is some basic code to work with and amend to your form, this code will clear only fields 1 and 3
Graham
Code: Select all
<html>
<body>
<div>
<input type="text" id="1" size="5"/>
</div>
<div>
<input type="text" id="2" size="5"/>
</div>
<div>
<input type="text" id="3" size="5"/>
</div>
<div>
<input type="button" onclick="clearFields()" value="No">
</div>
<script type="text/javascript">
function clearFields() {
document.getElementById("1").value=""
document.getElementById("3").value=""
}
</script>
</body>
</html>
Last edited by GrahamW on Fri Apr 08, 2022 4:00 am, edited 1 time in total.
Re: Clear form field
Here is a code snippet that uses the value of the "No" select (which is 2) to hide all selected inputs. For each label and field you want to hide give it a class of no in item properties. Paste the following in a html frame and set frame type to Before </body>
Code: Select all
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$('select').change(function () {
if($(this).val() === '2') {
$('.no').hide();
}
else {
$('.no').show();
}
});
</script>
If it wasn't for bad luck, I'd have no luck at all.
Re: Clear form field
Thanks a lot Graham.GrahamW wrote: ↑Thu Apr 07, 2022 6:00 am here is some basic code to work with and amend to your form, this code will clear only fields 1 and 3
GrahamCode: Select all
<html> <body> <div> <input type="text" id="1" size="5"/> </div> <div> <input type="text" id="2" size="5"/> </div> <div> <input type="text" id="3" size="5"/> </div> <div> <input type="button" onclick="clearFields()" value="No"> </div> <script type="text/javascript"> function clearFields() { document.getElementById("1").value="" document.getElementById("3").value="" } </script> </body> </html>
Re: Clear form field
thanks a lot JoeJoe_120 wrote: ↑Thu Apr 07, 2022 8:30 am Here is a code snippet that uses the value of the "No" select (which is 2) to hide all selected inputs. For each label and field you want to hide give it a class of no in item properties. Paste the following in a html frame and set frame type to Before </body>
Code: Select all
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script> $('select').change(function () { if($(this).val() === '2') { $('.no').hide(); } else { $('.no').show(); } }); </script>