#325 Some refactoring, validate find a ticket box
This commit is contained in:
parent
7e9c09e008
commit
002d6bdd9d
@ -88,6 +88,7 @@ $modsForHesk_settings = mfh_getSettings();
|
|||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-iconpicker.js"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-iconpicker.js"></script>
|
||||||
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script>
|
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script>
|
||||||
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/platform.js"></script>
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/platform.js"></script>
|
||||||
|
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-validator.min.js"></script>
|
||||||
<style>
|
<style>
|
||||||
.navbar-default {
|
.navbar-default {
|
||||||
background-color: <?php echo $modsForHesk_settings['navbarBackgroundColor']; ?>;
|
background-color: <?php echo $modsForHesk_settings['navbarBackgroundColor']; ?>;
|
||||||
|
@ -402,15 +402,20 @@ $more2 = empty($_GET['more2']) ? 0 : 1;
|
|||||||
<tr>
|
<tr>
|
||||||
<td valign="top">
|
<td valign="top">
|
||||||
|
|
||||||
<form class="form-inline" action="find_tickets.php" method="get" name="findby" id="findby">
|
<form data-toggle="validator" class="form-inline" action="find_tickets.php" method="get" name="findby" id="findby">
|
||||||
|
|
||||||
<table class="table" style="width: auto" border="0" cellpadding="3" cellspacing="0">
|
<table class="table" style="width: auto" border="0" cellpadding="3" cellspacing="0">
|
||||||
<tr style="border: none">
|
<tr style="border: none">
|
||||||
<td class="text-left" style="border: none">
|
<td class="text-left" style="border: none">
|
||||||
<b style="color: #000"><?php echo $hesklang['s_for']; ?></b><br/>
|
<b style="color: #000"><?php echo $hesklang['s_for']; ?></b><br/>
|
||||||
<input class="form-control" type="text" name="q" size="30" <?php if (isset($q)) {
|
<div class="form-group">
|
||||||
echo 'value="' . $q . '"';
|
<input class="form-control" type="text" name="q" size="30" <?php if (isset($q)) {
|
||||||
} ?> />
|
echo 'value="' . $q . '"';
|
||||||
|
} ?>
|
||||||
|
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
|
||||||
|
required>
|
||||||
|
<div class="help-block with-errors"></div>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="text-left" style="border: none">
|
<td class="text-left" style="border: none">
|
||||||
<b style="color: #000"><?php echo $hesklang['s_in']; ?></b><br/>
|
<b style="color: #000"><?php echo $hesklang['s_in']; ?></b><br/>
|
||||||
|
24
index.php
24
index.php
@ -1161,28 +1161,8 @@ function print_add_ticket()
|
|||||||
< -->
|
< -->
|
||||||
</form>
|
</form>
|
||||||
<script>
|
<script>
|
||||||
$('form[name="form1"]').validator({
|
buildValidatorForTicketSubmission("form1",
|
||||||
custom: {
|
"<?php echo addslashes($hesklang['select_at_least_one_value']); ?>");
|
||||||
checkbox: function($el) {
|
|
||||||
var checkboxes = $('input[name="' + $el.attr('data-checkbox') + '[]"]');
|
|
||||||
|
|
||||||
for (var checkbox in checkboxes) {
|
|
||||||
if (checkboxes[checkbox].checked) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
multiselect: function($el) {
|
|
||||||
var count = $('select[name="' + $el.attr('data-multiselect') + '[]"] :selected').length;
|
|
||||||
return count > 0;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
errors: {
|
|
||||||
checkbox: '<?php echo addslashes($hesklang['select_at_least_one_value']); ?>',
|
|
||||||
multiselect: '<?php echo addslashes($hesklang['select_at_least_one_value']); ?>'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -11,3 +11,28 @@ function validateRichText(helpBlock, messageGroup, messageContainer, errorText)
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function buildValidatorForTicketSubmission(formName, validationText) {
|
||||||
|
$('form[name="' + formName + '"]').validator({
|
||||||
|
custom: {
|
||||||
|
checkbox: function($el) {
|
||||||
|
var checkboxes = $('input[name="' + $el.attr('data-checkbox') + '[]"]');
|
||||||
|
|
||||||
|
for (var checkbox in checkboxes) {
|
||||||
|
if (checkboxes[checkbox].checked) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
multiselect: function($el) {
|
||||||
|
var count = $('select[name="' + $el.attr('data-multiselect') + '[]"] :selected').length;
|
||||||
|
return count > 0;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
errors: {
|
||||||
|
checkbox: validationText,
|
||||||
|
multiselect: validationText
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user