- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2016 08:29 AM
We have a Service Catalog Item with a single line field variable which has character limit to 40 characters.
I would like to make it so the user can't 'Order Now' until 40 characters are in that field.
Thank you,
Sarah
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2016 12:22 PM
Ty this:
function onSubmit() {
var text = g_form.getValue("u_epic_device_haiku_canto");
var length=text.length;
if(length <40)
{
alert("Please enter full field");
return false;
}}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2016 12:00 PM
Check on Onchange script for that field.
var textBox = g_form.getValue("field_name").length;
if(textBox <40)
{
alert("Please enter full field");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2016 12:22 PM
Ty this:
function onSubmit() {
var text = g_form.getValue("u_epic_device_haiku_canto");
var length=text.length;
if(length <40)
{
alert("Please enter full field");
return false;
}}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2016 01:09 PM
Thanks so much! That worked!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2020 11:04 PM
I have a similar challenge but in this case it should only be possible to enter six numbers from 0 to 9. How shold the if-sentence look like in order to achieve that?
Best regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2019 04:52 AM
Doesn't work. This field never saves.
Very lame that this happens. It's absurd that you can't set max_length, and that you'd need to rely on an onSubmit script to handle it.
So, I personally get the maxlength attribute set by manipulating the DOM via an SP widget:
I have a Single Line Text field named "upc" as a Catalog Item Variable.
