Add disallowSpecialCharacters to some fields

This commit is contained in:
Brian Federle 2013-07-23 14:22:54 -07:00
parent fcf111d80a
commit c1102fcc79
7 changed files with 16 additions and 7 deletions

View File

@ -22,6 +22,7 @@ label.disk.iops.min=Min IOPS
label.disk.iops.max=Max IOPS
label.disk.iops.total=IOPS Total
label.view.secondary.ips=View secondary IPs
message.validate.invalid.characters=Invalid characters found; please correct.
message.acquire.ip.nic=Please confirm that you would like to acquire a new secondary IP for this NIC.<br/>NOTE: You need to manually configure the newly-acquired secondary IP inside the virtual machine.
message.select.affinity.groups=Please select any affinity groups you want this VM to belong to:
message.no.affinity.groups=You do not have any affinity groups. Please continue to the next step.

View File

@ -25,6 +25,7 @@ under the License.
<% long now = System.currentTimeMillis(); %>
<script language="javascript">
dictionary = {
'message.validate.invalid.characters': '<fmt:message key="message.validate.invalid.characters" />',
'label.about': '<fmt:message key="label.about" />',
'label.about.app': '<fmt:message key="label.about.app" />',
'label.app.name': '<fmt:message key="label.app.name" />',

View File

@ -298,7 +298,7 @@ under the License.
<div class="field name hide-if-unselected">
<div class="name"> <span class="field-required">*</span> <fmt:message key="label.name"/></div>
<div class="value">
<input type="text" class="required" name="new-network-name" />
<input type="text" class="required disallowSpecialCharacters" name="new-network-name" />
</div>
</div>
@ -348,7 +348,7 @@ under the License.
<span><fmt:message key="label.name"/> (<fmt:message key="label.optional"/>)</span>
</div>
<div class="value">
<input type="text" name="displayname" />
<input type="text" name="displayname" class="disallowSpecialCharacters" />
</div>
</div>
<!-- Add to group -->
@ -357,7 +357,7 @@ under the License.
<span><fmt:message key="label.add.to.group"/> (<fmt:message key="label.optional"/>)</span>
</div>
<div class="value">
<input type="text" name="groupname" />
<input type="text" name="groupname" class="disallowSpecialCharacters" />
</div>
</div>
<!-- Zone -->

View File

@ -588,7 +588,7 @@
$('<div>').addClass('value').append(
$('<input>').attr({
type: 'text'
}).addClass('required')
}).addClass('required disallowSpecialCharacters')
)
);

View File

@ -588,7 +588,7 @@
type: 'text',
value: data
})
.data('original-value', data)
.addClass('disallowSpecialCharacters').data('original-value', data)
);
// Make option values from given array
@ -617,7 +617,7 @@
name: name,
type: 'text',
value: data
}).data('original-value', data)
}).addClass('disallowSpecialCharacters').data('original-value', data)
);
}

View File

@ -529,6 +529,11 @@
if (!$editInput.is(':visible') || !(typeof(args.action) == 'undefined')) { //click Edit button
showEditField();
} else if ($editInput.val() != $label.html()) { //click Save button with changed value
if ($editInput.val().match(/<|>/)) {
cloudStack.dialog.notice({ message: 'message.validate.invalid.characters' });
return false;
}
$edit.animate({
opacity: 0.5
});

View File

@ -918,6 +918,7 @@
$(field.range).each(function() { //e.g. field.range = ['privateport', 'privateendport'];
var $input = $('<input>')
.addClass('disallowSpecialCharacters')
.attr({
name: this,
type: 'text'
@ -941,7 +942,8 @@
name: fieldName,
type: field.isPassword ? 'password' : 'text'
})
.addClass(!field.isOptional ? 'required' : null)
.addClass(!field.isOptional ? 'required' : null)
.addClass('disallowSpecialCharacters')
.attr('disabled', field.isDisabled ? 'disabled' : false)
.appendTo($td);