Call Function with Star and Hash

hi

i am making an app that will call sepcial numbers to get a reply from the operator mainly it will be used to charge the prepaid line

ex: *111*1233#

i mannaged to make almost 90% of it but i just cant add the hash #

here is the code that will load some numbers and add them to the call

Hash="#" system.openURL( "tel:\*141\*"..tostring(IDNumber).."\*"..tostring(ChargeN)..tostring(Hash) )

ID number is just a number for the person ID

the ChargeN is the prepaid card number

this works and it call the *141*PLUS-THE-ID–PLUS the STAR* – PLUS the CharegN . but it didnot add the hash and the end

i tried another way

 system.openURL( "tel:\*141\*"..tostring(IDNumber).."\*"..tostring(ChargeN).."#" )

no luck also

any ideas ?

i guess it had something to do with the hash itself the # because i replaced the star in the code

system.openURL( "tel:\*141\*"..tostring(IDNumber).."\*"..tostring(ChargeN)..tostring(Hash) )

with

system.openURL( "tel:\*141\*"..tostring(IDNumber).."#"..tostring(ChargeN)..tostring(Hash) )

and the hash didn’t show , and before the star was shown in the same place using same way

i tried with this code and still not showing the hash

!

 system.openURL( "tel:\*141\*3333\*3333#" )

The # has a special meaning to URL’s. Its whats known as an anchor or fragment. The idea is that you could put #chapter1 at the end of the URL and the web browser would find an anchor tag in the body and scroll to it. It gets uses for many other things like SEO, tracking where people came from.  See:  for a great description of the # in a URL.

Now you might be able to escape the # using %23 in it’s place. But I don’t know if that will actually survive not being turned back into a # somewhere along the way and treated as an anchor tags.  See: http://stackoverflow.com/questions/5007352/how-to-escape-hash-character-in-url

Rob

Thanks Rob . :slight_smile: it works .

i just have another Question regarding the native.newTextField… how can limit the numbers that can be entered inside the TextField .

i don’t want someone to buffer Overflow my App by entering Millions of numbers  and exploit it later :)))

You should have a function that looks something similar to:

local function fieldHandler( textField )     return function( event )         if ( "began" == event.phase ) then             -- This is the "keyboard has appeared" event             -- In some cases you may want to adjust the interface when the keyboard appears.                  elseif ( "ended" == event.phase ) then             -- This event is called when the user stops editing a field: for example, when they touch a different field                      elseif ( "editing" == event.phase ) then                  elseif ( "submitted" == event.phase ) then             -- This event occurs when the user presses the "return" key (if available) on the onscreen keyboard             print( textField().text )                          -- Hide keyboard             native.setKeyboardFocus( nil )         end     end end

In the editing phase, you can do something like:

        elseif ( "editing" == event.phase ) then             textField().text = string.sub(textField().text, 1, maxLen)         elseif ( "submitted" == event.phase ) then

or something like that.

Rob

I am now changing my App for ios ( yes lots of headache to build of ios :slight_smile:

and now  i am facing the same issue with star and hash ( both of them on the ios )

i am trying now to bypass that and see .

i will update this soon

:frowning:

http://stackoverflow.com/questions/10795457/how-to-dial-a-phone-number-with/13198801#13198801

i guess there is no way to do this on ios

i guess it had something to do with the hash itself the # because i replaced the star in the code

system.openURL( "tel:\*141\*"..tostring(IDNumber).."\*"..tostring(ChargeN)..tostring(Hash) )

with

system.openURL( "tel:\*141\*"..tostring(IDNumber).."#"..tostring(ChargeN)..tostring(Hash) )

and the hash didn’t show , and before the star was shown in the same place using same way

i tried with this code and still not showing the hash

!

 system.openURL( "tel:\*141\*3333\*3333#" )

The # has a special meaning to URL’s. Its whats known as an anchor or fragment. The idea is that you could put #chapter1 at the end of the URL and the web browser would find an anchor tag in the body and scroll to it. It gets uses for many other things like SEO, tracking where people came from.  See:  for a great description of the # in a URL.

Now you might be able to escape the # using %23 in it’s place. But I don’t know if that will actually survive not being turned back into a # somewhere along the way and treated as an anchor tags.  See: http://stackoverflow.com/questions/5007352/how-to-escape-hash-character-in-url

Rob

Thanks Rob . :slight_smile: it works .

i just have another Question regarding the native.newTextField… how can limit the numbers that can be entered inside the TextField .

i don’t want someone to buffer Overflow my App by entering Millions of numbers  and exploit it later :)))

You should have a function that looks something similar to:

local function fieldHandler( textField )     return function( event )         if ( "began" == event.phase ) then             -- This is the "keyboard has appeared" event             -- In some cases you may want to adjust the interface when the keyboard appears.                  elseif ( "ended" == event.phase ) then             -- This event is called when the user stops editing a field: for example, when they touch a different field                      elseif ( "editing" == event.phase ) then                  elseif ( "submitted" == event.phase ) then             -- This event occurs when the user presses the "return" key (if available) on the onscreen keyboard             print( textField().text )                          -- Hide keyboard             native.setKeyboardFocus( nil )         end     end end

In the editing phase, you can do something like:

        elseif ( "editing" == event.phase ) then             textField().text = string.sub(textField().text, 1, maxLen)         elseif ( "submitted" == event.phase ) then

or something like that.

Rob

I am now changing my App for ios ( yes lots of headache to build of ios :slight_smile:

and now  i am facing the same issue with star and hash ( both of them on the ios )

i am trying now to bypass that and see .

i will update this soon

:frowning:

http://stackoverflow.com/questions/10795457/how-to-dial-a-phone-number-with/13198801#13198801

i guess there is no way to do this on ios