// Licensed Materials - Property of IBM // // IBM Cognos Products: ps // // (C) Copyright IBM Corp. 2005, 2011 // // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. // Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved. // Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated). //Functions used in client side validation function CAFSelectText(field, text) { field.focus(); if (text.length > 0) { if (field.createTextRange) { var textrange = field.createTextRange(); if (textrange != null) { textrange.moveStart("character", -1); textrange.findText(text); textrange.select(); textrange.scrollIntoView(); } } else { var startIdx = field.value.indexOf(text); var endIdx = startIdx + text.length; field.setSelectionRange(startIdx, endIdx); } } } /** * Checks if the given value is an integer * Note: use regular expression in order to avoid any server CAF error * @param value * @param unsigned indicates if it is unsigned or not * @return true if it is, false otherwise */ function CAFisInteger(value, unsigned) { var isInteger = false; var regExp = null; if (value != null && value != "") { if (unsigned) { regExp = new RegExp("^[0-9]+$"); } else { regExp = new RegExp("^-?[0-9]+$"); } isInteger = regExp.test(value); } return isInteger; } function CAFReportValidationError(msg) { alert(msg); }