Index: trunk/extensions/SemanticForms/specials/SF_CreateProperty.php |
— | — | @@ -106,6 +106,20 @@ |
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
| 110 | +function toggleAllowedValues(property_type) { |
| 111 | + var allowed_values_div = document.getElementById("allowed_values"); |
| 112 | + // Page, String, Number, Email - is that a reasonable set of types |
| 113 | + // for which enumerations should be allowed? |
| 114 | + if (property_type == '{$datatype_labels['_wpg']}' || |
| 115 | + property_type == '{$datatype_labels['_str']}' || |
| 116 | + property_type == '{$datatype_labels['_num']}' || |
| 117 | + property_type == '{$datatype_labels['_ema']}') { |
| 118 | + allowed_values_div.style.display = ""; |
| 119 | + } else { |
| 120 | + allowed_values_div.style.display = "none"; |
| 121 | + } |
| 122 | +} |
| 123 | + |
110 | 124 | END; |
111 | 125 | |
112 | 126 | // set 'title' as hidden field, in case there's no URL niceness |
— | — | @@ -125,7 +139,7 @@ |
126 | 140 | foreach ( $datatype_labels as $label ) { |
127 | 141 | $select_body .= " " . Xml::element( 'option', null, $label ) . "\n"; |
128 | 142 | } |
129 | | - $text .= Xml::tags( 'select', array( 'id' => 'property_dropdown', 'name' => 'property_type', 'onChange' => 'toggleDefaultForm(this.value);' ), $select_body ) . "\n"; |
| 143 | + $text .= Xml::tags( 'select', array( 'id' => 'property_dropdown', 'name' => 'property_type', 'onChange' => 'toggleDefaultForm(this.value); toggleAllowedValues(this.value);' ), $select_body ) . "\n"; |
130 | 144 | |
131 | 145 | $default_form_input = wfMsg( 'sf_createproperty_linktoform' ); |
132 | 146 | $values_input = wfMsg( 'sf_createproperty_allowedvalsinput' ); |