Created
September 12, 2019 07:34
-
-
Save anil826/3e75cb57590e09e6494e7e9ee4947dc8 to your computer and use it in GitHub Desktop.
SF Table validaion for Phone number based on regex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//SF table component - id | |
var component_id = "12da-62aa-a8dc"; | |
// on table render event | |
formyoula.form_fields[component_id ].on("table:results:render:rowCallback",function(){ | |
update_input_field(); | |
}) | |
//Check on table render success event | |
formyoula.form_fields[component_id ].on("table:results:render:success",function(){ | |
console.log("rendered*****"); | |
update_input_field(); | |
}) | |
//Input element | |
var update_input_field= function(){ | |
$.each($("#salesforce_table_"+component_id).find("td.Phone input"),function(key,value){ | |
console.log(key); | |
//validation based on regex | |
console.log(value); | |
$(value).attr("pattern", "^[+][7]\\d{10}$"); | |
$(value).attr("maxlength", "12"); | |
$(value).attr("minlength", "12"); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment