...
Code Block |
---|
|
public void validate( @Param FunctionCall fn, ContextVariables contextVariables, ValidationErrors errors )
{
int length = ...; // liczba wierszy pobrana z innego
for ( int i = 0; i < length; i++ )
{
contextVariables.set( "currentRow", i );
if ( !fn.<Boolean> call() )
{
errors.add( "Validation errror" );
}
}
} |
Zmienne kontekstowe w akcjach formularza
Ze względu na inne środowisko uruchamiania akcji formularza, sposób ustawiania tych zmiennych jest trochę inny. Wartość kontekstowych zmiennych ustawiamy przy użyciu metody setContextVariable
klasy
Jsdoc |
---|
property | jsdoc.plusworkflow |
---|
className | PW.form.action.Action |
---|
|
: Code Block |
---|
|
PW.FormActions.create('context-var-example', {
defaultActions: {
variableSet: function(vs, added, updated, removed) {
this.invoke(vs);
}
},
invoke: function(vs) {
var fn = this.get('fn');
var target = this.get('target');
PW.each(vs.getRecords(), function(record, index) {
this.setContextVariable("currentRow", index);
var newValue = fn.call();
target.setItemValue(newValue, index);
}, this);
}
}); |