You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
114 lines
4.0 KiB
114 lines
4.0 KiB
<!--*********************************************************************************
|
|
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
|
|
* ("License"); You may not use this file except in compliance with the License
|
|
* The Original Code is: vtiger CRM Open Source
|
|
* The Initial Developer of the Original Code is vtiger.
|
|
* Portions created by vtiger are Copyright (C) vtiger.
|
|
* All Rights Reserved.
|
|
*
|
|
********************************************************************************/
|
|
-->
|
|
<!-- BEGIN: main -->
|
|
<script language="JavaScript" type="text/javascript" src="include/general.js"></script>
|
|
<script language="JavaScript" type="text/JavaScript">
|
|
function splitValues() {
|
|
var picklistObj=getObj("listarea")
|
|
var pickListContent=picklistObj.value
|
|
var pickListAry=new Array()
|
|
var i=0;
|
|
|
|
//Splitting up of Values
|
|
if (pickListContent.indexOf("\n")!=-1) {
|
|
while(pickListContent.indexOf("\n")!=-1) {
|
|
if (pickListContent.replace(/^\s+/g, '').replace(/\s+$/g, '').length>0) {
|
|
pickListAry[i]=pickListContent.substr(0,pickListContent.indexOf("\n")).replace(/^\s+/g, '').replace(/\s+$/g, '')
|
|
pickListContent=pickListContent.substr(pickListContent.indexOf("\n")+1,pickListContent.length)
|
|
i++
|
|
} else break;
|
|
}
|
|
} else if (pickListContent.replace(/^\s+/g, '').replace(/\s+$/g, '').length>0) {
|
|
pickListAry[0]=pickListContent.replace(/^\s+/g, '').replace(/\s+$/g, '')
|
|
}
|
|
|
|
return pickListAry;
|
|
}
|
|
function setDefaultList() {
|
|
var pickListAry=new Array()
|
|
pickListAry=splitValues()
|
|
|
|
getObj("defaultlist").innerHTML=""
|
|
|
|
for (i=0;i<pickListAry.length;i++) {
|
|
var objOption=document.createElement("OPTION")
|
|
if (browser_ie) {
|
|
objOption.innerText=pickListAry[i]
|
|
objOption.value=pickListAry[i]
|
|
} else if (browser_nn4 || browser_nn6) {
|
|
objOption.text=pickListAry[i]
|
|
objOption.setAttribute("value",pickListAry[i])
|
|
}
|
|
|
|
getObj("defaultlist").appendChild(objOption)
|
|
}
|
|
}
|
|
function validate() {
|
|
if (emptyCheck("listarea","Picklist values")) {
|
|
var pickListAry=new Array()
|
|
pickListAry=splitValues()
|
|
//Empty Check validation
|
|
for (i=0;i<pickListAry.length;i++) {
|
|
if (pickListAry[i]=="") {
|
|
alert("Picklist value cannot be empty")
|
|
picklistObj.focus()
|
|
return false
|
|
}
|
|
}
|
|
|
|
//Duplicate Values' Validation
|
|
for (i=0;i<pickListAry.length;i++) {
|
|
for (j=i+1;j<pickListAry.length;j++) {
|
|
if (pickListAry[i]==pickListAry[j]) {
|
|
alert("Duplicate Values found")
|
|
picklistObj.focus()
|
|
return false
|
|
}
|
|
}
|
|
}
|
|
|
|
document.editPickListForm.submit();
|
|
}
|
|
}
|
|
</script>
|
|
<body>
|
|
<form name="editPickListForm" method="post" action="index.php">
|
|
<p></p>
|
|
<input type="hidden" name="action" value="UpdateComboValues">
|
|
<input type="hidden" name="module" value="Settings">
|
|
<input type="hidden" name="table_name" value="{TABLENAME}">
|
|
<input type="hidden" name="column_name" value="{COLUMNNAME}">
|
|
<input type="hidden" name="field_name" value="{FIELDNAME}">
|
|
<input type="hidden" name="field_module" value="{FIELDMODULE}">
|
|
<table width="70%" border=0 cellspacing=1 cellpadding=5 class="formOuterBorder">
|
|
<tr><td class="formSecHeader" colspan="2">{MOD.LBL_FIELD_INFORMATION}</td></tr>
|
|
<tr>
|
|
<td nowrap class="dataLabel" width="20%">{MOD.FieldName}:</td>
|
|
<td class="bodyText bold">{FIELDNAME}</td>
|
|
</tr>
|
|
<tr>
|
|
<td nowrap valign=top class="dataLabel">{MOD.Values}:</td>
|
|
<td class="bodyText">{MOD.EnterListOfValues}
|
|
<br><TEXTAREA wrap="SOFT" NAME="listarea" ROWS="15" style="width:100%" onChange="setDefaultList()">{FLDVALUES}</TEXTAREA></td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
<table width="60%" border="0" cellpadding="0" cellspacing="0">
|
|
<tr>
|
|
<td align=center>
|
|
<input type="button" name="save" value="{APP.LBL_SAVE_BUTTON_LABEL}" class="button" onclick="return validate();">
|
|
<input type="button" name="cancel" class="button" value="{APP.LBL_CANCEL_BUTTON_LABEL}" onclick="window.history.back()">
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
</body>
|
|
<!-- END: main -->
|
|
|