New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compare input type="number" values using if? #193
Comments
Yes. You can use if-else statements with Contao's simple tokens. You may want to check the docs: https://docs.contao.org/manual/de/de/core-erweiterung/newsletter/newsletter-verwaltung/ You can also see that it works because it's all covered by unit tests in the Contao core: https://github.com/contao/contao/blob/master/core-bundle/tests/Contao/StringUtilTest.php#L122-L180
That's not true, just select the |
You get a
|
Impressive response time. Thanks!
This is exactly what I tried first, when doing so and using this:
it always triggered the {else} statements with the == operator always worked with no problems for me. But now im hopeful i just made a mistake so I will try again! will update soon. |
it's probably |
Thanks for the hint, but {if feld<10000} is not a valid token (i can't save the notification if i put it like that) I've tried again now and it's true that the text field with "numeric characters" creates a type="number" (not sure why i assumed it doesnt) After reading @Toflar first link, i can confirm that i can use any of the statements mentioned in the article with no problems. They all use the == operator though. After Reading into Toflar's second link found the tests for the Operator I want to use.
So, do i have to change something else in my condition in order to compare values with '<' other than changing the operator itself?
works just fine, while this:
doesnt |
I just tried the unit tests again and it works for me so I'm sorry but there's nothing else we can do here for you. Just make sure you use the latest versions of Contao (4.4.44 or 4.8.4) and the NC (1.5.8). |
Okay. Thanks! I redid it on a different system that runs 4.4.44 / 1.5.8. Unfortunately the problem still persists. I even tried with negative values and comparing to 0 like in the unit test but to no success. I'm all out of ideas now. I will try to find someone else to confirm/deny this and let you know either way. |
I'm scratching my head here. Unfortunately i also couldnt find anyone on the contao forums yet to either confirm or deny the problem im having. In the meantime, @Toflar can you confirm that this should be the correct statement in a notification?
|
Jup, looks okay to me. |
Hello everyone,
First of all thanks for the great extension to everyone involved. Have been using it for a while now and it works great!
I've been trying to change the Text on a email notification based on the numeric value of an input.
Basically, if the user enters a value smaller than 10000, show "Text X" else show "Text Y"
Is that possible?
I was hesitant to post here, because Contao seems to be missing the option to select an input type 'number' in the form generator (that im pretty sure used to exist at some point in the past). So the Issue might be there.
That's why I've tried to work around it by creating a custom html-field of the _input type="number" name="test", but it seems the notification_center does not recognize that. ##form_test## is not replaced with its value in the Email.
I've also posted my Question to the German contao Forums
I'm aware this is not a support service, but im thankful for any hints if and how this could be realized even if some coding would be required.
The text was updated successfully, but these errors were encountered: