Custom Validation before saving something

I am trying to hide an element based on whether or not a user has filled out all the user inputs on a page after the click an add button. I am using stripe connect thats coded into our site since the Pay API doesn’t work with connect. Before a user selects the payment button (payment is run through an HTML window) they add items to there cart. What I would like is that when they click the add to cart button, if they haven’t put something in every input the HTML element is hiden an a warning shows up “oops you forgot to fill out a field”. I then have an inputX_keyPress event that shows the window and hides the oops message. Is there a way to do this? It seems like the custom validation is only for saving, any ideas? Here is the section of code I’m stuck on

export function button3_click(event) {
 if (.or($w("#input6").valid === false)
    .or($w("#input14").valid === false))
  {
    $w("#html1").hide();
    $w("#oopsMessage").show();
  }
 else{
$w("#stallPurchaseTotal").value = 
  ($w("#stallType1Price").value * $w("#numberType1Stalls").value)+

Seems to me that your if statement should be:

if ($w("#input6").valid === false || $w("#input14").valid === false)

@yisrael-wix Thank you again!

1 Like