- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2016 11:25 AM
Hey guys,
I have a need for a string variable (tra_course0) to contain a "$" in the user's input. I can't seem to quite get the syntax right on how to get a catalog client script to read the input, search for the "$" at the beginning and if it's not included to alert them to include it. Any ideas? Ideally I want the input to START WITH the $ but if nothing else I would like it to CONTAIN the $.
Thanks in advance for you assistance!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2016 11:33 AM
You have a javascript method called startsWith() for this. Use that, you code will look like this
JavaScript String startsWith() Method
if(!g_form.getValue('field name').startsWith("$")){
alert("message goes here");
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2016 11:28 AM
So you want to validate a text field to see if it stats with "$" right?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2016 11:30 AM
That is correct!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2016 11:33 AM
You have a javascript method called startsWith() for this. Use that, you code will look like this
JavaScript String startsWith() Method
if(!g_form.getValue('field name').startsWith("$")){
alert("message goes here");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2016 11:39 AM
I was trying to mess with 'contains'.. 😕 now I realize I was needing to use 'includes'. But this is exactly what I wanted.
That worked perfectly!
Thanks!!