Commit d74d17ef authored by John Punzalan's avatar John Punzalan

Update form esi admin entity and news

parent d8ab26d4
...@@ -59,7 +59,7 @@ add_thickbox(); ...@@ -59,7 +59,7 @@ add_thickbox();
<label for="entity_type_id"><?php _e( 'Entity Type', 'esi' ); ?></label> <label for="entity_type_id"><?php _e( 'Entity Type', 'esi' ); ?></label>
</th> </th>
<td> <td>
<select id="entity_type_id" name="entity_type_id"> <select id="entity_type_id" name="entity_type_id" required="required">
<option value="0">Select an Entity Type</option> <option value="0">Select an Entity Type</option>
<?php foreach ($entity_types as $entity_type) : ?> <?php foreach ($entity_types as $entity_type) : ?>
<option value="<?= $entity_type->id ?>" <?= ($entity_type->id == $item->entity_type_id)?'selected="selected"':'' ?>><?= $entity_type->name ?></option> <option value="<?= $entity_type->id ?>" <?= ($entity_type->id == $item->entity_type_id)?'selected="selected"':'' ?>><?= $entity_type->name ?></option>
...@@ -202,7 +202,7 @@ add_thickbox(); ...@@ -202,7 +202,7 @@ add_thickbox();
<label for="technology_id"><?php _e( 'Technology', 'esi' ); ?></label> <label for="technology_id"><?php _e( 'Technology', 'esi' ); ?></label>
</th> </th>
<td> <td>
<select id="technology_id" class="chosen-select" name="technology_id[]" multiple="multiple"> <select id="technology_id" class="chosen-select" name="technology_id[]" multiple="multiple" required="required">
<?php foreach ($technologies as $technology) : ?> <?php foreach ($technologies as $technology) : ?>
<option value="<?= $technology->id ?>" <?= (in_array($technology->id, $technologies_selected)) ? "selected='selected'" : ""?>><?= $technology->name ?></option> <option value="<?= $technology->id ?>" <?= (in_array($technology->id, $technologies_selected)) ? "selected='selected'" : ""?>><?= $technology->name ?></option>
<?php endforeach; ?> <?php endforeach; ?>
......
...@@ -93,6 +93,10 @@ class Esi_Management_News_Form { ...@@ -93,6 +93,10 @@ class Esi_Management_News_Form {
$errors[] = __( 'Error: Radar function is required', 'esi' ); $errors[] = __( 'Error: Radar function is required', 'esi' );
} }
if ( ! $technology_ids ) {
$errors[] = __( 'Error: Technology is required', 'esi' );
}
// bail out if error found // bail out if error found
if ( $errors ) { if ( $errors ) {
$first_error = reset( $errors ); $first_error = reset( $errors );
......
...@@ -100,7 +100,7 @@ add_thickbox(); ...@@ -100,7 +100,7 @@ add_thickbox();
<label for="entity_id"><?php _e( 'Entity', 'esi' ); ?></label> <label for="entity_id"><?php _e( 'Entity', 'esi' ); ?></label>
</th> </th>
<td> <td>
<select id="entity_id" name="entity_id[]" class="chosen-select" multiple="multiple" style="float:left"> <select id="entity_id" name="entity_id[]" class="chosen-select" multiple="multiple" required="required" style="float:left">
<option value="0">Select a entity</option> <option value="0">Select a entity</option>
<?php foreach ($companies as $entity) : ?> <?php foreach ($companies as $entity) : ?>
<option value="<?= $entity->id ?>" <?= (in_array($entity->id, $entities_selected)) ? "selected='selected'" : ""?>><?= $entity->name ?></option> <option value="<?= $entity->id ?>" <?= (in_array($entity->id, $entities_selected)) ? "selected='selected'" : ""?>><?= $entity->name ?></option>
...@@ -159,7 +159,7 @@ add_thickbox(); ...@@ -159,7 +159,7 @@ add_thickbox();
<label for="technology_id"><?php _e( 'Technology', 'esi' ); ?></label> <label for="technology_id"><?php _e( 'Technology', 'esi' ); ?></label>
</th> </th>
<td> <td>
<select id="technology_id" class="chosen-select" name="technology_sub_id[]" multiple="multiple"> <select id="technology_id" class="chosen-select" name="technology_sub_id[]" multiple="multiple" required="required" >
<?php foreach ($technologies as $technology) : ?> <?php foreach ($technologies as $technology) : ?>
<option value="<?= $technology->id ?>" <?= (in_array($technology->id, $technologies_selected)) ? "selected='selected'" : ""?>><?= $technology->name ?></option> <option value="<?= $technology->id ?>" <?= (in_array($technology->id, $technologies_selected)) ? "selected='selected'" : ""?>><?= $technology->name ?></option>
<?php endforeach; ?> <?php endforeach; ?>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment