Bug in report with Text parameter

If you create a report with a text field parameter, then you might have notice that sometimes your parameter is ignored.

This is because the app wait a return pressed event after you entered your parameter value.

 

To correct this bug, replace the method in JSTextInputControlCell:

- (BOOL)textFieldShouldReturn:(UITextField *)txtField

 

by

- (BOOL)textFieldShouldEndEditing:(UITextField *)textField

 

With this modification, the selectedValue will be set even if the user don't press the enter button. This might happend very often, cause the user fill the textfield and directly select the desired output (HTML / PDF) without pressing "enter" before.

 

Hope this helped ;)

 

djt's picture
djt
127
Joined: Oct 25 2011 - 2:05am
Last seen: 9 years 5 months ago

2 Answers:

Hi djt,

thanks for your suggestion!

 

Giulio

giulio's picture
70344
Joined: Jan 2 2007 - 4:15pm
Last seen: 1 week 6 days ago

Hi,

No problem, thank you too for this app, it helped me to develop an iPad version of it ;)

What i said was a bit wrong.....

THIS is the modification to apply. You should keep the "textFieldShouldReturn" method (because it manage many things, not only saving the value) and add the following one just under:


- (BOOL)textField:(UITextField *)txtField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
    NSString *newValue = nil;
    if(range.length>0){
        newValue = [[NSString alloc] initWithString:[txtField.text substringToIndex:txtField.text.length-1]];
    }else{
        newValue = [[NSString alloc] initWithFormat:@"%@%@", txtField.text, string];
    }
    NSLog(@"new selectedValue: %@", newValue);
    [super setSelectedValue:newValue];
    [newValue release];
    return YES;
}

 

This method will catch every character pressed by the user in the text field (even backspace and past) and save the result in the selectedValue field. i don't call the [self setSelectedValue] because you have implemented it differently to catch the case where the value is nil. so i call the super one :)

Sorry for the mistake. I created an issue for that, i will add the same comment to it and close it (if I'm allowed to).

I stay available for any further questions,

Regards,

DJT

djt's picture
djt
127
Joined: Oct 25 2011 - 2:05am
Last seen: 9 years 5 months ago
Feedback