how to validate texboxes whose values depend on another textboxes values

10 views
Skip to first unread message

Franklin Brauning

unread,
Dec 7, 2016, 12:22:30 PM12/7/16
to Nitrogen Project / The Nitrogen Web Framework for Erlang
Suppose I have several textboxes containg formulas

 #textbox { id=a }     <-- user sets text to "b + 1"
 #textbox { id=b }     <--- user sets text to "2"

to validate a I have to get b's text. How could this be done with nitrogen



Jesse Gumm

unread,
Dec 7, 2016, 1:44:41 PM12/7/16
to nitrogenweb
Hi Franklin,

The trick to this is using a #custom{} validator.

Inside the event function that handles the validator, you can call wf:q/1 as if it were any other kind of postback (because it is indeed a typical postback).  This is the key to how the #confirm_same{} validator works: https://github.com/nitrogen/nitrogen_core/blob/master/src/validators/validator_confirm_same.erl



--
You received this message because you are subscribed to the Google Groups "Nitrogen Project / The Nitrogen Web Framework for Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nitrogenweb+unsubscribe@googlegroups.com.
To post to this group, send email to nitro...@googlegroups.com.
Visit this group at https://groups.google.com/group/nitrogenweb.
For more options, visit https://groups.google.com/d/optout.



--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866 || sigma-star.com || @jessegumm
Reply all
Reply to author
Forward
0 new messages