Hey there,
i'm trying to build a multipage form and it already looks pretty similar to this one here: https://www.wix.com/code/home/example/Multistage-Form
But now, I've got a question:
There's a button to get to the next page. Is it possible to make this button only available when the input on the current slide is valid? As an example: In this multistage form here, "First Name" is required. I want to achieve, that the button "Save & Continue" only works, if "First Name" is valid, so somebody typed his name in that field.
Same if somebody typed text into a number-field. This is not valid, so the button should not be available so that the user can't jump to the next slide.
Looking forward to your help!
Hello, I'm trying to do exactly the same thing as the OP, I have managed to get my button to work if the 2 inputs have a value above 50. but should the button be clicked before values are selected, it disables and doesn't come back on. my code is below which i just copied from above.
i'm very new to this, it's the last 4 lines that I don't understand, what does the #text120 relate to? and the 2000.
thanks for any help in advance
export function button3_click(event, $w, reject) { if ($w('#dropdown1').value > 50 && $w('#dropdown2').value > 25 ){ $w('#slideshow1').changeSlide(1); } else { $w('#button3').disable() $w('#text120').show(); setTimeout (function () { $w('#button3').enable() },2000)
OH MY GOD THANK YOU
I have been tinkering for weeks and couldnt get any straight answers and that is exactly what I have been looking for
Thank you so much
Try changing "$w("#answerC")" to $w("#answerC").text
Hey I have a sort of similar problem with my user input validation. Every user input for my quiz is being marked "incorrect" no matter what. The answers are generated from a database, and into a hidden text box that appears after the user input is submitted.
I need code to check the user input against the text box. This seems simple but I cant find anything to help.
Here is my code atm:
export function button1_click() {
$w("#input1").onCustomValidation((value => {
if ($w("#input1").value !== $w("#answerC")){
$w("#incorrect").show();
$w("#answerC").show();
$w("#correct").hide();
}
else {
$w("#correct").show();
$w("#answerC").show();
$w("#incorrect").hide();
}
Using wix codes dynamic pages and databases will keep me from having to program 1200+ iterations for each type of question one at a time. I really need this to work and it seems like it should be a simple fix.
If you are able to help I would be eternally grateful
Glad that I could help you!
It works... you're a genius. Thanks alot!!
Wow! Nice one... let me try
Hi there,
what I did (and what I see as a good solution) is the following. You can disable the button for 2 seconds and reenable it when the input in the fields is not valid. Here input1 has to be filled out (not empty) and input2 needs to be bigger than 300.
export function button_click(event, $w, reject) { if ($w('#input1').value !== '' && $w('#input2').value > 300 ){ showSlide2(); } else { $w('#button').disable() $w('#text120').show(); setTimeout (function () { $w('#button').enable() },2000) } }
Wix code doesn't support custom validation on multistage form. Have to ditch multistage form and put 100 input elements on single page for it to work. Site looks so displeasing
Can anyone share some snippets on how to implement validation for a multistage form?
none of the examples given help with the multistage form setup
Did you find a solution to this, not going to next slide until fields are filled? If so, Can you kindly share. Thx
Hi,
The article Validating User Input with Code will help you with this. You can also look at the appropriate validation properties and functions that are available for many components. Look at the valid property of TextInput as an example.
Good luck,
Yisrael