Advertisement
Guest User

Untitled

a guest
Jan 31st, 2019
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.74 KB | None | 0 0
  1. <h2>Editing</h2>
  2. <p>Please note that only certain options can be edited once a field is created. If you need to edit the others,
  3. delete the field and create a new one or CAREFULLY edit the database.</p>
  4. <?php
  5. $fieldQ = $db->query("SELECT * FROM $name WHERE id = ?",array($field));
  6. $fieldC = $fieldQ->count();
  7. if($fieldC > 0){
  8. $f = $fieldQ->first();
  9. }else{
  10. Redirect::to($us_url_root."admin.php?view=forms_edit&edit=".$edit."&err=Field+not+found.");
  11. } ?>
  12. <form class="" name="createForm" action="admin.php?view=forms_edit&edit=<?=$edit?>" method="post">
  13. <input type="hidden" name="editing" value="<?=$field?>">
  14. <div class="form-group">
  15. <label for="">Label when displaying forms</label>
  16. <input class="form-control" type="text" name="form_descrip" value="<?=$f->form_descrip?>" required>
  17. </div>
  18.  
  19. <div class="form-group">
  20. <label for="">Label when displaying tables(often shorter)</label>
  21. <input class="form-control" type="text" name="table_descrip" value="<?=$f->table_descrip?>" required>
  22. </div>
  23.  
  24. <div class="form-group">
  25. <label for="">Order</label>
  26. <input class="form-control" type="number" name="ord" value="<?=$f->ord?>" min="0" step="1" required>
  27. </div>
  28.  
  29. <div class="form-group">
  30. <label for="">Required?</label>
  31. <select class="form-control" name="required" required>
  32. <option value="<?=$f->required?>"><?php bin($f->required);?></option>
  33. <option value="0">No</option>
  34. <option value="1">Yes</option>
  35. </select>
  36. </div>
  37.  
  38. <div class="form-group">
  39. <label for="">Class</label>
  40. <input class="form-control" type="text" name="field_class" value="<?=$f->field_class?>" >
  41. </div>
  42.  
  43. <div class="form-group">
  44. <label for="">Raw HTML inside input tag</label>
  45. <textarea class="form-control" name="input_html" rows="4" cols="120"><?=$f->input_html?></textarea>
  46. </div>
  47. <?php require_once($abs_us_root.$us_url_root."users/views/_form_validation_options.php");?>
  48. <?php
  49. if($f->field_type == 'dropdown' || $f->field_type == 'radio' || $f->field_type == 'checkbox'){
  50. $current = json_decode($f->select_opts);
  51. ?>
  52. <table class="table" id="opts">
  53.  
  54. <thead>
  55. <tr>
  56. <th>DB Value</th>
  57. <th>Visible Value</th>
  58. </tr>
  59. </thead>
  60. <tbody>
  61. <tr>
  62. <td><a id="add">+ Add Another Option</a></td>
  63. </tr>
  64. <?php foreach($current as $k=>$v){ ?>
  65. <tr>
  66. <td><input type="text" name="key[]" value="<?=$k?>"></td>
  67. <td><input type="text" name="val[]" value="<?=$v?>"></td>
  68. </tr>
  69. <?php } ?>
  70. </tbody>
  71. </table>
  72. <?php } ?>
  73.  
  74. <input type="submit" name="edit_this_field" value="Save Field Settings" class="btn btn-primary">
  75. </form>
  76. <div class="form-group">
  77. <?php
  78. $val = json_decode($f->validation);
  79. ?>
  80. <table class="table" id="valTable">
  81. <label for="">Current Validation Options</label>
  82. <thead>
  83. <tr>
  84. <th>Option</th><th>Value</th><th>Delete</th>
  85. </tr>
  86. </thead>
  87. <tbody>
  88.  
  89. <?php if($val != ''){
  90. foreach($val as $k=>$v){ ?>
  91. <tr>
  92. <td><?=$k?></td>
  93. <td><?=$v?></td>
  94. <td><form class="" action="" name="deleteForm" method="post">
  95. <input type="hidden" name="toDelete" value="<?=$k?>">
  96. <input type="submit" name="deleteValidation" class="btn" value="Delete This"></form></td>
  97. </tr>
  98. <?php }
  99. }else{
  100. echo "<br><font color='red'>No validation options are set.</font>";
  101. } ?>
  102.  
  103. </tbody>
  104. </table>
  105. </div>
  106.  
  107. <script type="text/javascript">
  108. $(document).ready(function() {
  109. $("#add").click(function() {
  110. $('#opts tbody>tr:last').clone(true).insertAfter('#opts tbody>tr:last');
  111. $('#opts tbody>tr:last .clearIt').val('');
  112. return false;
  113. });
  114. });
  115. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement