iOS text field
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
iOS text field
Is there a way I can limit a text field to only accept 1 line of information, specifically not allow the use of return button within that field..
Further to that can I also make it limit it's input to numbers only.. ( I know I can start numerical keyboard but this doesn't stop the entry of letters)
Further to that can I also make it limit it's input to numbers only.. ( I know I can start numerical keyboard but this doesn't stop the entry of letters)
Re: iOS text field
Nakia...
I have attached a stack that will do what you wish...
be well
Dixie
I have attached a stack that will do what you wish...
be well
Dixie
- Attachments
-
- numbersOnly.livecode.zip
- (2.4 KiB) Downloaded 309 times
Re: iOS text field
Hi,
thanks kindly.
This gives me a lot more than I require so maybe there is an easier way than this.
Basically,
I have a card with 3 text fields on it.
two of the fields require letters and the third requires numbers.
so basically I want to..
if either of the first two fields are selected open the Standard IOS keyboard (without shift enabled) but change the Return key to "done"
if the third is selected open the IOS "Numeric" keyboard and again change the Return key to "done"
Am I correct in thinking if I can use the "done" in place of return this will limit the number of lines in that filed to 1? because you cant press return?
--
Is there an easier way to achieve what I require?
thanks kindly.
This gives me a lot more than I require so maybe there is an easier way than this.
Basically,
I have a card with 3 text fields on it.
two of the fields require letters and the third requires numbers.
so basically I want to..
if either of the first two fields are selected open the Standard IOS keyboard (without shift enabled) but change the Return key to "done"
if the third is selected open the IOS "Numeric" keyboard and again change the Return key to "done"
Am I correct in thinking if I can use the "done" in place of return this will limit the number of lines in that filed to 1? because you cant press return?
--
Is there an easier way to achieve what I require?
Re: iOS text field
Its well documented in the release notes on page 24. As far as the single line field iphonecontrolcreate on page 47. Don't create a multiline field unless you want multi lines.
iphoneSetKeyboardReturnKey returnKey Where returnKey is one of:
• default – the normal return key
• go – the 'Go' return key
• google – the 'Google' return key
• join – the 'Join' return key
• next – the 'Next' return key
• route – the 'Route' return key
• search – the 'Seach' return key
• send – the 'Send' return key
• yahoo – the 'Yahoo' return key
• done – the 'Done' return key
• emergency call – the 'emergency call' return key
iphoneSetKeyboardReturnKey returnKey Where returnKey is one of:
• default – the normal return key
• go – the 'Go' return key
• google – the 'Google' return key
• join – the 'Join' return key
• next – the 'Next' return key
• route – the 'Route' return key
• search – the 'Seach' return key
• send – the 'Send' return key
• yahoo – the 'Yahoo' return key
• done – the 'Done' return key
• emergency call – the 'emergency call' return key
Re: iOS text field
Thanks heaps.
got the Keyboard stuff all sorted
Just gotta sort out the single line text field...
Thanks again
got the Keyboard stuff all sorted

Just gotta sort out the single line text field...
Thanks again
Re: iOS text field
so just to check my understanding.. (sorry to keep bothering everyone)
I have used the iphoneSetKeyboardType function to set the keyboard to the type I need using the openField message on each of the Fields(kept default Return)..
Now I can just use an iphoneControlCreate "input" (with what ever options I need) and just use the inputReturnKey message to apply the appropriate task when the user presses the return key..(note- I would be best putting the ipohoneControlCreate in the openCard handler)
would I make the bounds of this Control the area over my 3 text fields or just group them and use the rect of that group?
I have used the iphoneSetKeyboardType function to set the keyboard to the type I need using the openField message on each of the Fields(kept default Return)..
Now I can just use an iphoneControlCreate "input" (with what ever options I need) and just use the inputReturnKey message to apply the appropriate task when the user presses the return key..(note- I would be best putting the ipohoneControlCreate in the openCard handler)
would I make the bounds of this Control the area over my 3 text fields or just group them and use the rect of that group?
Re: iOS text field
Here is a multiline I did recently that sets the location to the location of image "InfoRect" and inserts text from a hidden field "info". This particular field is non editable"false" because it just gives the user information.
on opencard
if the environment is "mobile" then
if "testinput" is among the lines of iphoneControls() then
inputDelete
end if
iphoneControlCreate "multiline", "testinput"
iphoneControlSet "testinput", "rect", the rect of image "InfoRect"
iphoneControlSet "testinput", "visible", true
iphoneControlSet "testinput", "fontsize", "14"
iphoneControlSet "testinput", "text", field "info"
iphoneControlSet "testinput","editable","false"
updateFieldProps
end if
end open card
Here is the code (below) for a single line iOS text field with some more script work below on how to close the control so it doesn't follow you to the next card you navigate to. =]
local inputID
on openCard
if environment() <> "mobile" then exit openCard
iphoneControlCreate "input"
put the result into inputID
iphoneControlSet inputID, "rect", the rect of grc 2
iphoneControlSet inputID, "visible", "true"
iphoneControlSet inputID, "opaque", "false"
iphoneControlSet inputID, "fontName", "Helvetica"
iphoneControlSet inputID, "fontSize", 18
iphoneControlSet inputID, "borderStyle", "none"
iphoneControlSet inputID, "clearButtonMode", "unless editing"
iphoneControlSet inputID, "autoCapitalizationType", "words"
iphoneControlSet inputID, "autoCorrectionType", "No"
iphoneControlSet inputID, "autoClear", "false"
end openCard
on closeCard
iphoneControlDelete inputID
end closeCard
on inputReturnKey
answer iphonecontrolGet(inputID, "text") && "yea baby"
end inputReturnKey
on inputBeginEditing
put iphonecontrolGet(inputID, "text") into fld 1
end inputBeginEditing
on opencard
if the environment is "mobile" then
if "testinput" is among the lines of iphoneControls() then
inputDelete
end if
iphoneControlCreate "multiline", "testinput"
iphoneControlSet "testinput", "rect", the rect of image "InfoRect"
iphoneControlSet "testinput", "visible", true
iphoneControlSet "testinput", "fontsize", "14"
iphoneControlSet "testinput", "text", field "info"
iphoneControlSet "testinput","editable","false"
updateFieldProps
end if
end open card
Here is the code (below) for a single line iOS text field with some more script work below on how to close the control so it doesn't follow you to the next card you navigate to. =]
local inputID
on openCard
if environment() <> "mobile" then exit openCard
iphoneControlCreate "input"
put the result into inputID
iphoneControlSet inputID, "rect", the rect of grc 2
iphoneControlSet inputID, "visible", "true"
iphoneControlSet inputID, "opaque", "false"
iphoneControlSet inputID, "fontName", "Helvetica"
iphoneControlSet inputID, "fontSize", 18
iphoneControlSet inputID, "borderStyle", "none"
iphoneControlSet inputID, "clearButtonMode", "unless editing"
iphoneControlSet inputID, "autoCapitalizationType", "words"
iphoneControlSet inputID, "autoCorrectionType", "No"
iphoneControlSet inputID, "autoClear", "false"
end openCard
on closeCard
iphoneControlDelete inputID
end closeCard
on inputReturnKey
answer iphonecontrolGet(inputID, "text") && "yea baby"
end inputReturnKey
on inputBeginEditing
put iphonecontrolGet(inputID, "text") into fld 1
end inputBeginEditing
Re: iOS text field
Okay,
so I have this working in a fashion but still have questions..
1. I have 3 text flds on this card that I need the control to behave differently for so do I need to create a separate control for each???
I.E. if the users presses on fld 1 the text he enters go into fld 1 on return, if he presses on fld 2 the text goes there etc etc.
2. I was previously using the SetKeyBoardType msg to display a "numeric" keyboard on fld 3 (using openFld) but this obviously wont work now as this control deals with this input..should I set the numeric keyboard as part of the control (if so how?) or should I just pass the openFld message to the fld?
Thanks in advanced...
so I have this working in a fashion but still have questions..
1. I have 3 text flds on this card that I need the control to behave differently for so do I need to create a separate control for each???
I.E. if the users presses on fld 1 the text he enters go into fld 1 on return, if he presses on fld 2 the text goes there etc etc.
2. I was previously using the SetKeyBoardType msg to display a "numeric" keyboard on fld 3 (using openFld) but this obviously wont work now as this control deals with this input..should I set the numeric keyboard as part of the control (if so how?) or should I just pass the openFld message to the fld?
Thanks in advanced...
Re: iOS text field
Hi Nakia,
when setting up the input field you add the keyboard type to the setup
Kind regards
Bernd
when setting up the input field you add the keyboard type to the setup
Code: Select all
iPhoneControlSet inputid, "keyboardType", "numeric"
Bernd
Re: iOS text field
K thanks
Any advice on my other points in the above post?
Any advice on my other points in the above post?
Re: iOS text field
Hi Nakia,

Kind regards
Bernd
no, since I don't really understand what you are doing. Just try and see what works, I guessAny advice on my other points in the above post?

Kind regards
Bernd
Re: iOS text field
I suppose what I am trying to ask is.....
If I have 3 text fields on a card and want the iphoneControl to work differently on each of them do I create a Control for each?
2 need to display regular keyboard, one needs to display numeric and they each need to send data to underlying fld...
maybe the attached Tiff will help?
If I have 3 text fields on a card and want the iphoneControl to work differently on each of them do I create a Control for each?
2 need to display regular keyboard, one needs to display numeric and they each need to send data to underlying fld...
maybe the attached Tiff will help?
- Attachments
-
- Untitled.tiff (5.79 KiB) Viewed 9754 times
Re: iOS text field
As far as I know you do need to set up eachIOS text field with as many lines of code as necessary for each individual field and also name each one uniquely. It's basically a cut and paste operation with some editing afterward.
Re: iOS text field
Okay then.
I spent some hours plaything with different things last night and it appears I am right. I need to set up an IOS Text field for each of the fields I need to control...
Wish there was an easier way as it seems a little complicated for what I am trying to do...

I spent some hours plaything with different things last night and it appears I am right. I need to set up an IOS Text field for each of the fields I need to control...
Wish there was an easier way as it seems a little complicated for what I am trying to do...
