// ...
'require validation';
// ...

// Add a new validation type
validation.types.host_optional_port = function(ipv4only) {
	var hp = this.value.split(/:/);
	if (hp.length == 1) {
		return this.assert(this.apply('host', hp[0], [ipv4only]), _('valid host'));
	}
	return this.assert(hp.length == 2 && this.apply('host', hp[0], [ipv4only]) && this.apply('port', hp[1]),
		_('valid host:port'));
}

return L.view.extend({
	render: function() {
	// ...

	o = ...
	o.datatype = "host_optional_port"
	// ...
}