how to avoid blank spaces in field value at begining and ending
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2016 06:13 PM
my question is name field value contains any blank spaces at beginning and ending form is not submitted.
so please tell me on submit code for that..
Thanks,
Rambabu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2016 06:25 PM
You can use trim function for removing extra spaces...
Re: Getting a value of a description
Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2016 10:32 PM
hi deepa,
my requirement is field does not allows blank spaces at beginning and ending.
i done myself that field does not contains blank spaces its fine. but my requirement is field not allows blank spaces at beginning and ending.
But spaces allows between name(ex:ram chow).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2016 10:58 PM
Hello ram,
Try this regular expression and see if it helps solve your issue;
regex - trim in javascript ? what this code is doing? - Stack Overflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2016 11:31 PM
You can write on submit client script like below.(Here I am validating short description field)
function onSubmit() {
//Type appropriate comment here, and begin script below
var sd = g_form.getValue('short_description');
var last = sd.charAt(sd.length-1);
var first = sd.charAt(0);
//alert("1st:"+first +"//Last:"+last);
if(first ==' '|| last == ' '){
alert("text contains blank spaces in beginning or end");
return false;
}
}
Thanks,
Mihir