How to make +91 as default in phone field data type

i made a doctype which has phone number field in it, it also has country code now i want to select india country code by default

For my Reference, there is no option to set +91 in data field, but you can add Phone in options of data field

Set the default as +91- from the customize form.

It’s not an officially supported feature but it works because phone number fields just store the number as +{countrycode}-{phonenumber}

This however will validation failure, so you should write some script to remove it before save in case phone number is not specified. It will be fairly simple:

if doc.phone_number == "+91-":
    doc.phone_number = ""

Alternatively, do both setting default and clearing from client script.

1 Like

can u pls show how u did it ? as far as i know phone field is just to enter no… we cant add list of country code to select from , or can we ?

Thanks for this. Was helpful :slight_smile:.

Under “Customize Form”, you can set the default value for various field.

To keep 91 as default in phone field
Set +91- in default option

Set +91- in default option for phone fieldtype
so the country code will appear default