Answered by:
Update as certain format in text field data type?

Question
-
Hi,
I need to update the field in certain format. DD/MM (e-g) (23/06). Shall we make a JS on 'Single text field'?
Thanks
Prakash
- Edited by prakashmsdyn Friday, January 18, 2013 3:53 PM
Friday, January 18, 2013 3:51 PM
Answers
-
Hi,
Forget the latest posts, you want validate the user input, right?
So you have two options:
1 - Insert a mask, take a look http://thetaoofcrm.com/2011/05/19/crm-field-masking-with-jquery/
2 - Validate with a regular expression, very powerful, take a look http://blog.webfortis.com/post/2012/04/07/MS-CRM-2011-Field-Formatting-and-Regular-Expression-Objects-with-JavaScript.aspx
Hope FINALLY this helps.
If i answered your question, please mark the response as an answer and also vote as helpful.
Pedro Azevedo Crm Specialist 4.0\2011
- Proposed as answer by Azevedo PedroMVP Monday, January 21, 2013 6:07 PM
- Marked as answer by prakashmsdyn Tuesday, January 22, 2013 9:45 AM
Monday, January 21, 2013 6:06 PM
All replies
-
Hi,
I don't know if you have a date, but you can do something like that:
var d = new Date(); var curr_date = d.getDate(); var curr_month = d.getMonth() + 1; //Months are zero based var curr_year = d.getFullYear(); Xrm.Page.getAttribute(“new_att”).setValue(curr_date + "/" + curr_month);
Hope this helps.
If i answered your question, please mark the response as an answer and also vote as helpful.Pedro Azevedo Crm Specialist 4.0\2011
- Proposed as answer by Azevedo PedroMVP Friday, January 18, 2013 4:01 PM
Friday, January 18, 2013 4:01 PM -
Hi Pedro,
In CRM 2011, I think we cannot set the value on Date field. But your suggestion be helpful. Is there any idea?
THanks
Monday, January 21, 2013 11:21 AM -
Can we set to allow "/" character on Decimal field data type.Monday, January 21, 2013 12:01 PM
-
Hi,
In Date Field is correct that you can't change the format. You can for example add a text custom field that show the format you want.
And the character "/" is not possible in a Decimal field, what are you trying to do?
Hope this helps.
If i answered your question, please mark the response as an answer and also vote as helpful.Pedro Azevedo Crm Specialist 4.0\2011
- Proposed as answer by Azevedo PedroMVP Monday, January 21, 2013 12:05 PM
Monday, January 21, 2013 12:05 PM -
Hi Pedro,
Am still confusing. Could you suggest, How exactly.
So far, I got the user input as 'Free Text field', code behind that I used.
function dayMonth()
{
var dm = Xrm.Page.getAttribute("new_renewaldate").getValue();
var isnum = /^[0123][0-9]\/[01][0-9]$/;
if (dm.search(isnum) != -1)
{
}
else
{
alert("Please enter the date format DD/MM");
}
}But this not exactly did. But okay for timebeing.
Thanks
Monday, January 21, 2013 5:45 PM -
Hi,
Forget the latest posts, you want validate the user input, right?
So you have two options:
1 - Insert a mask, take a look http://thetaoofcrm.com/2011/05/19/crm-field-masking-with-jquery/
2 - Validate with a regular expression, very powerful, take a look http://blog.webfortis.com/post/2012/04/07/MS-CRM-2011-Field-Formatting-and-Regular-Expression-Objects-with-JavaScript.aspx
Hope FINALLY this helps.
If i answered your question, please mark the response as an answer and also vote as helpful.
Pedro Azevedo Crm Specialist 4.0\2011
- Proposed as answer by Azevedo PedroMVP Monday, January 21, 2013 6:07 PM
- Marked as answer by prakashmsdyn Tuesday, January 22, 2013 9:45 AM
Monday, January 21, 2013 6:06 PM