opened
carbocation
username_0
Is it possible to have a validator that depends on other fields in the form?

For example, if someone is looking for housing an they choose between a "minimum value" and a "maximum value", it would be nice to indicate that both of those fields are invalid if the minimum value is greater than the maximum value.
Validation checking on other fields?
issue
created
mats-claassen
username_1
Hi,
At this moment it is not directly supported. But you could use the onChangeBlock called when the value of a row is changed to achieve something like that
comment
closed
mats-claassen
username_1
issue
created
i-am-chris
username_2
how do you achieve that?
i have 
`
-(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor oldValue:(id)oldValue newValue:(id)newValue
{
    // super implementation MUST be called
    [super formRowDescriptorValueHasChanged:rowDescriptor oldValue:oldValue newValue:newValue];

if([rowDescriptor.tag isEqualToString:@"f1_from"])
    {
        //NSString * evenMoreNewValue = [[NSString alloc] initWithFormat:@"Hi %@ !", newvalue];
        
        //NSDate *mydate = dataVeche;
        NSDate *myDate  = [NSDate new];
        NSTimeInterval secondsIn3Hours = 3 * 60 * 60;
        NSDate *date3hAhead = [myDate dateByAddingTimeInterval:secondsIn3Hours];
        NSLog(@"data in 3 h is: %@",date3hAhead);
        theNewV1  = newValue;
        NSLog(@"%@",theNewV1);
    }
if([rowDescriptor.tag isEqualToString:@"f1_to"]) {
theNewV2 =  [NSDate dateWithTimeInterval:3600*3 sinceDate:theNewV1];
        NSLog(@"🐕🐕🐕🐕🐕 %@",theNewV2);
[self reloadFormRow:rowDescriptor]; 

/// HERE?? i need to set this minimum date to be ahead of the f1_from + 3h 
}
    }
`
comment
created
mats-claassen
username_1
Hi @username_2 you can call `formRowWithTag` on your form to get that row. Then you get the value of that row and add those 3 hours.
comment