Expand my Community achievements bar.

Validation: Set Focus same field

Avatar

Level 2

Using FormCalc, I am trying to validate a field on exit, but want to set the focus to the same field until the user fixes the error.

I know I can use the statement $host.setFocus("ObjectName") , but can I call the object as a this (current object) instead of entering the name of the object explicitly?

2 Replies

Avatar

Former Community Member

this is not a part of FormCalc ...it is only valid in javascript. The $ is a replacement for this. Note that the parameter that you pass in is a SomExpression so you shoudl use $.somExpression

Paul

Avatar

Level 2

Tried this and worked.

$host.setFocus ($.name)


Thanks.