aaronk Well-Known Member Licensed User Longtime User Jul 22, 2012 #1 Hello, Just wondering how to only allow a IP address to be entered into a textbox? I need to be able to only allow an IP address in the textbox such as 192.168.0.2 I know you can select: - None - Numbers - Decimal Numbers - Text - Phone But, I need to make it user friendly, so based on the options above the only best one so far is to use is Text, unless someone can help me out..
Hello, Just wondering how to only allow a IP address to be entered into a textbox? I need to be able to only allow an IP address in the textbox such as 192.168.0.2 I know you can select: - None - Numbers - Decimal Numbers - Text - Phone But, I need to make it user friendly, so based on the options above the only best one so far is to use is Text, unless someone can help me out..
M Mahares Expert Licensed User Longtime User Jul 22, 2012 #2 Here is a link to some nice code by Erel that will do exactly what you want: http://www.b4x.com/forum/basic4andr...sing-regex-validate-ip-address.html#post88781 To limit the input to only numbers and periods add the IME library to the IDE and and these lines to your code, assuming you edit text name is MyEditText. Code: Copy Dim IME as IME IME.Initialize("IME") IME.SetCustomFilter(MyEditText,MyEditText.INPUT_TYPE_NUMBERS,"0123456789.") Last edited: Jul 22, 2012 Upvote 0
Here is a link to some nice code by Erel that will do exactly what you want: http://www.b4x.com/forum/basic4andr...sing-regex-validate-ip-address.html#post88781 To limit the input to only numbers and periods add the IME library to the IDE and and these lines to your code, assuming you edit text name is MyEditText. Code: Copy Dim IME as IME IME.Initialize("IME") IME.SetCustomFilter(MyEditText,MyEditText.INPUT_TYPE_NUMBERS,"0123456789.")
aaronk Well-Known Member Licensed User Longtime User Jul 23, 2012 #3 Based on your code, it doesn't let me select the dot (.) it seems to show the number pad but there is no button for the dot. Upvote 0
Based on your code, it doesn't let me select the dot (.) it seems to show the number pad but there is no button for the dot.
mc73 Well-Known Member Licensed User Longtime User Jul 23, 2012 #4 aaronk said: Based on your code, it doesn't let me select the dot (.) it seems to show the number pad but there is no button for the dot. Click to expand... I think this is a bug with some devices but I don't recall right now brands. perhaps HTC, can't remember :-( Upvote 0
aaronk said: Based on your code, it doesn't let me select the dot (.) it seems to show the number pad but there is no button for the dot. Click to expand... I think this is a bug with some devices but I don't recall right now brands. perhaps HTC, can't remember :-(
M Mahares Expert Licensed User Longtime User Jul 23, 2012 #5 I just want to be sure that you have not forgotten the dot in:"0123456789." I tested the code on a device with OS4.03 and another tablet with OS2.2 before I posted it and both worked well. They showed the dot along with the numbers in the keypad. Perhaps, it is a bug in some devices as mc73 mentioned. Upvote 0
I just want to be sure that you have not forgotten the dot in:"0123456789." I tested the code on a device with OS4.03 and another tablet with OS2.2 before I posted it and both worked well. They showed the dot along with the numbers in the keypad. Perhaps, it is a bug in some devices as mc73 mentioned.