Bug in report with Text parameter

0

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
13
Joined: Oct 25 2011 - 2:05am
Last seen: 5 years 10 months ago

2 Answers:

0

Hi djt,

thanks for your suggestion!

 

Giulio

giulio's picture
23536
Joined: Jan 2 2007 - 4:15pm
Last seen: 6 months 2 weeks ago
0

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
13
Joined: Oct 25 2011 - 2:05am
Last seen: 5 years 10 months ago
Feedback
randomness