equal
deleted
inserted
replaced
1 /** |
1 /** |
2 * $Id: form_utils.js 673 2008-03-06 13:26:20Z spocke $ |
2 * $Id: form_utils.js 1184 2009-08-11 11:47:27Z spocke $ |
3 * |
3 * |
4 * Various form utilitiy functions. |
4 * Various form utilitiy functions. |
5 * |
5 * |
6 * @author Moxiecode |
6 * @author Moxiecode |
7 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. |
7 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. |
11 |
11 |
12 function getColorPickerHTML(id, target_form_element) { |
12 function getColorPickerHTML(id, target_form_element) { |
13 var h = ""; |
13 var h = ""; |
14 |
14 |
15 h += '<a id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;" class="pickcolor">'; |
15 h += '<a id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;" class="pickcolor">'; |
16 h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"></span></a>'; |
16 h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"> </span></a>'; |
17 |
17 |
18 return h; |
18 return h; |
19 } |
19 } |
20 |
20 |
21 function updateColor(img_id, form_element_id) { |
21 function updateColor(img_id, form_element_id) { |
48 if (!cb) |
48 if (!cb) |
49 return ""; |
49 return ""; |
50 |
50 |
51 html = ""; |
51 html = ""; |
52 html += '<a id="' + id + '_link" href="javascript:openBrowser(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;" class="browse">'; |
52 html += '<a id="' + id + '_link" href="javascript:openBrowser(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;" class="browse">'; |
53 html += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"></span></a>'; |
53 html += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"> </span></a>'; |
54 |
54 |
55 return html; |
55 return html; |
56 } |
56 } |
57 |
57 |
58 function openBrowser(img_id, target_form_element, type, option) { |
58 function openBrowser(img_id, target_form_element, type, option) { |
90 } |
90 } |
91 |
91 |
92 function getSelectValue(form_obj, field_name) { |
92 function getSelectValue(form_obj, field_name) { |
93 var elm = form_obj.elements[field_name]; |
93 var elm = form_obj.elements[field_name]; |
94 |
94 |
95 if (elm == null || elm.options == null) |
95 if (elm == null || elm.options == null || elm.selectedIndex === -1) |
96 return ""; |
96 return ""; |
97 |
97 |
98 return elm.options[elm.selectedIndex].value; |
98 return elm.options[elm.selectedIndex].value; |
99 } |
99 } |
100 |
100 |