sachintaware
3 Jan 2012, 3:45 AM
Hello
Earlier i have got working an email application and this is a sms one.
So, I have to extract the phone numbers from the grid(Achieved this .)
But,the problem is in the Validation.I have to validate the numbers before sending them to the senders list.
i.e the list has mobile no and fixed line numbers(which cant receive sms).So I have to eliminate the bad data.
This is the code(below) to get the numbers but before setting the values i need to validate them in the required format.
1) Get the length of the number and if it is greater or less then 10.(Valid mobile number)
2) After checking length,eliminating irrelevant nos and prepend each number with the country code i.e 91.
After these checks the numbers will be in the required format and can be used.
var smsbtn = new Ext.Button({
text :'Send SMS',
scale :'large',
enableToggle:true,
renderTo:'buttonSms',
handler : function(){
var phnNo = new Array();
for(var j=0; j< store_company.getCount(); j++)
{
phnNo.push(store_company.getAt(j).get('statename'));
Ext.getCmp('sms-to').setValue(phnNo);
Ext.getCmp('send-sms-window').show();
}
}
});
Hoping for comments
Regards
Sach
Earlier i have got working an email application and this is a sms one.
So, I have to extract the phone numbers from the grid(Achieved this .)
But,the problem is in the Validation.I have to validate the numbers before sending them to the senders list.
i.e the list has mobile no and fixed line numbers(which cant receive sms).So I have to eliminate the bad data.
This is the code(below) to get the numbers but before setting the values i need to validate them in the required format.
1) Get the length of the number and if it is greater or less then 10.(Valid mobile number)
2) After checking length,eliminating irrelevant nos and prepend each number with the country code i.e 91.
After these checks the numbers will be in the required format and can be used.
var smsbtn = new Ext.Button({
text :'Send SMS',
scale :'large',
enableToggle:true,
renderTo:'buttonSms',
handler : function(){
var phnNo = new Array();
for(var j=0; j< store_company.getCount(); j++)
{
phnNo.push(store_company.getAt(j).get('statename'));
Ext.getCmp('sms-to').setValue(phnNo);
Ext.getCmp('send-sms-window').show();
}
}
});
Hoping for comments
Regards
Sach