I have four input fields (i.e. txtIntlPhoneNo1, txtIntlPhoneNo2, txtIntlPhoneNo3, and txtIntlPhoneNo4) that contains data for an International Phone Number. Input fields "txtIntlPhoneNo1" and "txtIntlPhoneNo2" are static fields (99 and 011 respectively). "TxtIntlPhoneNo3" contains the Country Code (which varies in Len) and "txtIntlPhoneNo4" contains the remaining digits of the phone number.
The data is saved in the db within one field (i.e. txtPhoneNo). Data may appear as 99 011 93 123456666.
What I would like to do is look for the first "space" found (after 011), then extract that data within its appropriate field (i.e. txtIntlPhoneNo3") up until where the second space is found and extract that data within its appropriate field (i.e. txtIntlPhoneNo4).
I'm currently using the Mid & Right functions, but that is currently not working. Finding that the Len(txtPhoneNo) will vary. I think finding where the a space exists and extracting that data will probably be more efficient.
Any assistance that can be provided is greatly appreciated.![[ponytails2] [ponytails2] [ponytails2]](/data/assets/smilies/ponytails2.gif)
The data is saved in the db within one field (i.e. txtPhoneNo). Data may appear as 99 011 93 123456666.
What I would like to do is look for the first "space" found (after 011), then extract that data within its appropriate field (i.e. txtIntlPhoneNo3") up until where the second space is found and extract that data within its appropriate field (i.e. txtIntlPhoneNo4).
I'm currently using the Mid & Right functions, but that is currently not working. Finding that the Len(txtPhoneNo) will vary. I think finding where the a space exists and extracting that data will probably be more efficient.
Code:
<cfscript>
...
variables.txtIntlPhoneNo3=Mid(qryRequesters.txtPhoneNo,8,3);
variables.txtIntlPhoneNo4=Right(qryRequesters.txtPhoneNo,16);
</cfscript>
<!--- Dialing Out Prefix --->
<input type="text" name="txtIntlPhoneNo1" maxlength="3" size="1" value="99" onfocus="promptEntry(stxtPhoneNo)"> -
<!--- Intl Dialing Prefix --->
<input type="text" name="txtIntlPhoneNo2" maxlength="3" size="1" value="011" onfocus="promptEntry(stxtPhoneNo)"> -
<!--- Country Code --->
<input type="text" name="txtIntlPhoneNo3" maxlength="5" size="6" value="#Variables.txtIntlPhoneNo3#" onfocus="promptEntry(stxtCountryCode)"> -
<!--- Remaining Digits of Phone Number --->
<input type="text" name="txtIntlPhoneNo4" maxlength="16" size="20" value="#Variables.txtIntlPhoneNo4#" onfocus="promptEntry(stxtPhoneNo)">
Any assistance that can be provided is greatly appreciated.
![[ponytails2] [ponytails2] [ponytails2]](/data/assets/smilies/ponytails2.gif)