mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Replaced alert()s in UniqueFields.js with statusMessage()s, to be less obnoxious
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@62865 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
be90ef6573
commit
c2b70b7bc5
@ -4,13 +4,11 @@ UniqueFormField.prototype = {
|
|||||||
// check that the value is not in use, and matches the pattern
|
// check that the value is not in use, and matches the pattern
|
||||||
var suggested = this.value;
|
var suggested = this.value;
|
||||||
|
|
||||||
while( this.restrictedValues[suggested] || suggested == null ) {
|
if( this.restrictedValues[suggested] || suggested == null ) {
|
||||||
alert(this.restrictedMessage);
|
suggested = this.suggestNewValue();
|
||||||
|
statusMessage("Changed value to " + suggested + ". " + this.restrictedMessage);
|
||||||
suggested = prompt('The following might be a suitable URL segment for the page. Alternatively, you can modify it.', this.suggestNewValue() );
|
this.value = suggested;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.value = suggested;
|
|
||||||
},
|
},
|
||||||
suggestNewValue: function() {
|
suggestNewValue: function() {
|
||||||
var parts = this.value.match( /(.*)(\d+)$/ );
|
var parts = this.value.match( /(.*)(\d+)$/ );
|
||||||
@ -107,17 +105,19 @@ UniqueRestrictedTextField.prototype = {
|
|||||||
var suggestedValue = this.restrictedValues[suggested];
|
var suggestedValue = this.restrictedValues[suggested];
|
||||||
}
|
}
|
||||||
|
|
||||||
while( suggested == null || suggested.length == 0 || suggestedValue || suggested.match( this.charRegex ) ) {
|
if( suggested == null || suggested.length == 0 || suggestedValue || suggested.match( this.charRegex ) ) {
|
||||||
|
var message;
|
||||||
if( suggested == null )
|
if( suggested == null )
|
||||||
alert('You will need to enter a new value for this field');
|
message = 'You will need to enter a new value for this field';
|
||||||
else if( suggested.length == 0 )
|
else if( suggested.length == 0 )
|
||||||
alert('This field cannot be left empty');
|
message = 'This field cannot be left empty';
|
||||||
else if( suggestedValue )
|
else if( suggestedValue )
|
||||||
alert(this.restrictedMessage);
|
message = this.restrictedMessage;
|
||||||
else
|
else
|
||||||
alert(this.charMessage);
|
message = this.charMessage;
|
||||||
|
|
||||||
suggested = prompt('The following might be a suitable URL segment for the page. Alternatively, you can modify it.', this.suggestNewValue() );
|
suggested = this.suggestNewValue();
|
||||||
|
statusMessage("Changed value to " + suggested + ". " + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.value = suggested;
|
this.value = suggested;
|
||||||
|
Loading…
Reference in New Issue
Block a user