How to allow integers & decimal numbers in string field

Rajesh Mushke
Mega Sage
Mega Sage

Hi team,

How to allow integers & decimal numbers in string field and avoiding alphabets



Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke
1 ACCEPTED SOLUTION

This this instead. The RegEx in the other example is incorrect.



function onChange(control, oldValue, newValue, isLoading, isTemplate) {


        if (isLoading || newValue === '') {


                  return;


        }



        var regexp = /^[\d\.]+$/;



        if(!regexp.test(newValue)) {


                  alert('Only numbers and dot allowed');


                  g_form.setValue('u_fieldname','');


        }    


}


View solution in original post

11 REPLIES 11

Rajesh Mushke
Mega Sage
Mega Sage

thank you so much chuck, it's working now.




Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke

You we are welcome. If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.



If you are viewing this from the community inbox you will not see the correct answer button.   If so, please review How to Mark Answers Correct From Inbox View.



Thank you