Skip to content
Snippets Groups Projects
Commit 853e12cb authored by Chris Hallberg's avatar Chris Hallberg
Browse files

Move phonenumber validation to form to prevent enter submits from bypassing it.

parent 8b15fbb9
No related merge requests found
......@@ -88,9 +88,11 @@ function phoneNumberFormHandler(numID, regionCode) {
}
$(phoneInput).siblings('.help-block.with-errors').html(valid);
$(phoneInput).closest('.form-group').addClass('sms-error');
return false;
} else {
$(phoneInput).closest('.form-group').removeClass('sms-error');
$(phoneInput).siblings('.help-block.with-errors').html('');
return true;
}
}
......@@ -319,7 +321,7 @@ function setupAutocomplete() {
method:'getACSuggestions',
searcher:searcher['searcher'],
type:searcher['type'] ? searcher['type'] : $(op).closest('.searchForm').find('.searchForm_type').val(),
hiddenFilters:hiddenFilters
hiddenFilters:hiddenFilters
},
dataType:'json',
success: function(json) {
......
......@@ -9,7 +9,7 @@
. '<li class="active">' . $this->transEsc('Text this') . '</li>';
?>
<?=$this->flashmessages()?>
<form method="post" name="smsRecord" class="form-horizontal">
<form method="post" name="smsRecord" class="form-horizontal"<? if(isset($this->validation) && !empty($this->validation)):?> onsubmit="return phoneNumberFormHandler('sms_to', '<?=$this->validation ?>')"<? endif; ?>>
<input type="hidden" name="id" value="<?=$this->escapeHtmlAttr($this->driver->getUniqueId())?>" />
<input type="hidden" name="source" value="<?=$this->escapeHtmlAttr($this->driver->getSourceIdentifier())?>" />
<div class="form-group">
......@@ -42,7 +42,7 @@
</div>
<div class="form-group">
<div class="col-sm-9 col-sm-offset-3">
<input class="btn btn-primary" type="submit" name="submit" value="<?=$this->transEsc('Send Text')?>"<? if(isset($this->validation) && !empty($this->validation)):?> onClick="return phoneNumberFormHandler('sms_to', '<?=$this->validation ?>')"<? endif; ?>/>
<input class="btn btn-primary" type="submit" name="submit" value="<?=$this->transEsc('Send Text')?>"/>
</div>
</div>
</form>
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