This topic is locked

Change handling of input into 'simple search ' field

3/19/2024 12:10:08 PM
ASPRunner.NET Tips and tricks
D
david powell author

Hi All,

I have a form with a simple search box.

I am capturing the input into the box and doing processing on it before executing the search.

I would like to use the input from a qr code into this box ( this works pefectly using a text field and a tripart button event to process its contents.)

BUT I have hit a snag: the \n characters are stripped out by the search box - this makes it impossible to parse the contents.

I have tested this: If I have a section of text, including \n characters for example in notepad as a series of lines of data, and paste it into the search field the newlines disappear - so if I then copy the contents immediately back onto notepad, it is a single text line.

Is there a way of modifying how the search box handles its input to leave the \n alone?

Ideally I would change the barcode scanner to send a different delimiter between lines, but I dont have control over them so this is not an option.

If anyone has any ideas, I would be very grateful to hear them!

david

D
david powell author 3/19/2024

I can see why they are removed - this box responds to an 'enter' keystroke by processing the contents; if there are \n in the input string it is perhaps going to interfere with this action.

However - is there still a way of preventing this behaviour and allowing the raw input string to be entered without modification?