Hello,
I have an SC that I need to validate a set value if it’s null.
If it’s null, I need to let the front-end from know it’s invalid.
I tried the != to null and edit the JSON to remove quote, still not working.
Hello,
I have an SC that I need to validate a set value if it’s null.
If it’s null, I need to let the front-end from know it’s invalid.
I tried the != to null and edit the JSON to remove quote, still not working.
Which of the 3 values on your screenshot are you trying to check on the front end?
I am not trying to check it on the front end, I am checking on SC and pass back if it’s valid or not.
The variable i am checking is customer_numeric_number
So what would you like to do with the value on the front end?
The user is entering the value on the front-end. I need to make sure the value is not null before doing a database check.
So basically if the user enters this “H0002D” it would be invalid and null because this happens before the database check:
{{$_POST.customer_number.substr(1, 8).toNumber()}}
If a valid sequence is entered, then I have to do a database check to see if that number is active.
Sorry i really don’t get the logic you are after.
Can you explain with some simple example what you are trying to achieve exactly?
I think you can use the “Required” validation
I tried that, it catches the null and return “This field is required.” - Perfect
But if the customer_numeric_number has a value of numeric (example “9”) it still returns “This field is required."
Breakdown:
User register and enter a registration code:
"H00009"
I split that registration code to know industry and registration number.
I need to make sure the code is numeric before running a test on the database to see if that code is valid for registration.
To get the proper number, I am converting “00009” to “9” using:
{{$_POST.customer_number.substr(1, 8).toNumber()}}
If someone enters “H0008D” that code above returns null.
I want to run a validate check to make sure it’s not null, but I don’t know how to do that on Server Connect API.
If it’s a valid code and database check comes back valid, then I need to move the customer to a full registration page for them to enter their user details etc… but I need to pass the registration code in two parts:
Industry: “H”
Reg_Number: “9”
Can you show a screenshot of your browser request and response? If that really happens it’s a bug
You can use a condition step after the setvalue used to check this. Use the setvalue as a condition, so this will check if the step returns a value - THEN - run your steps, ELSE return an invalid response, using the Response step and an invalid HTTP status.
Working on it, I’ll let you know the outcome
Could you show the expression on check_null?
Also, I’ve realized you could do the != null in the expression, and check if it equals to true
I got it somewhat working… its returning 400 with:
How do I tell that form field there is an invalid input base on that response?
Sorry, I am extremely new to wappler.
I am guessing Dynamic Events check if return code and show error, but i don’t see an option to display form error.
Sorry, I deleted it.
Teodor missed that, go back to your old approach
Lol … damn this should be easy lol …
Can I run JavaScript on expression ? In the validate part ?
Lol i try faking and invalid validation inside the else logic, but that’s a no-go!
Here is the screenshot you asked for:
It’s not JavaScript but it’s very similar. In the expression try:
{{ customer_numeric_number != null }}
And then in the Validation rules use the “Equals To” true
Alternatively, I’d personally use:
{{ !customer_numeric_number }}
And then in the Validation rules use the “Equals To” true
The Wappler team built their own expression parser/lexer