Placing required flag back into the edit form in management
authorLaury GvR <laury@gaslightmedia.com>
Thu, 26 Oct 2017 19:54:46 +0000 (15:54 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Thu, 26 Oct 2017 19:54:46 +0000 (15:54 -0400)
views/admin/management/fields.html

index 1f4086e..b2f97bc 100644 (file)
                     (text or checkbox only)
                 </td>
             </tr>
+            <tr>
+                <th>Required?</th>
+                <td>
+                    <input type="hidden" name="required" value="0" />
+                    <input type="checkbox" id="editRequired" name="required" value="1" />
+                </td>
+            </tr>
             <input type="hidden" name="uid" value="{$uid}">
         </table>
         <p><span class="glm-required">*</span> Required</p>
@@ -197,10 +204,12 @@ jQuery(document).ready(function($) {
         var fieldName   = $(this).text();
         var fieldType   = $(this).attr('data-fieldType');
         var adminSearch = $(this).attr('data-adminSearch');
+        var required    = $(this).attr('data-required');
+        
         $('#editFieldID').val(fieldID);
         $('#editFieldName').val(fieldName.trim());
         $('#editFieldType').val(fieldType);
-        console.log(adminSearch);
+        
         if (adminSearch === '1') {
             console.log('setting the checked to true');
             $('#editAdminSearch').prop('checked', true);
@@ -208,6 +217,13 @@ jQuery(document).ready(function($) {
             console.log('setting the checked to false');
             $('#editAdminSearch').prop('checked', false);
         }
+        // check required fields
+        if (required === '1') {
+            $('#editRequired').prop('checked', true);
+        } else {
+            console.log('setting the checked to false');
+            $('#editRequired').prop('checked', false);
+        }
         $("#editFieldDialog").dialog("open");
     });
     $('#editFieldCancel').click( function() {