36
Views
5
Comments
Solved
How can i check if value is bigger then a certain number?

Hello i have an input field where i wanna do a check if number is higher then 8 or not. I looked online and people said i could do it with JS, but i don't know how to pass values into JS. 


this is my action + JS

and this is my input field: \

so simplified: if an user puts 10 into the input field, i need to get an error message back. If a user puts 4, it saves it into the DB

2021-05-18 19-42-11
Gabriel Melo
Solution

Hi, @Kemal Ozdogan.

I don't think you need JS to do this. You can just compare if GetWorkedDayById.List.Current.WorkedDays.WorkedHour > 8 using If.

Edit: As your column WorkedHour is a text, it will be necessary to convert to integer using TextToInteger() function, resulting TextToInteger(GetWorkedDayById.List.Current.WorkedDays.WorkedHour) > 8 



Hope this helps.

UserImage.jpg
Kemal Ozdogan

Everything is getting saved into the DB still, even if workedHour is bigger then 8

UserImage.jpg
Kemal Ozdogan

I needed to do TextToInt on the workedhour aggregate and not on the 8 :D

2021-05-18 19-42-11
Gabriel Melo

Use TextToInteger function in WorkedHour attribute, doing that you will compare both values as numbers.

TextToInteger(GetWorkedDayById.List.Current.WorkedDays.WorkedHour) < 8

UserImage.jpg
Kemal Ozdogan

haha yeahh did that, thank you for the help :D

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.