Custom string Validator
Hi allMy case:
The TextInput string validator should accept a - z A - Z characters [(No numbers, No special characters like @ +-/ *) (?...)]
and if the user cross this rule, the border highlighted in red would seem so.
I managed to show the red alert border for numbers but not for special characters. I need your help to find now
to resolve this problem.
Here this custom String validator:
package
{
Import mx.validators.Validator;
Import mx.validators.ValidationResult;
SerializableAttribute public class CustomStringValidator extends {Validator
Set the table for the return value of doValidation().
private var: table of results;
Manufacturer.
public void CustomStringValidator() {}
Call the base class constructor.
Super();
}
Set the doValidation() method.
override protected function doValidation(value:Object):Array {}
Table of clear results.
results = [];
expression of the var: RegExp = new RegExp();
Call the base doValidation() class.
results = super.doValidation (value);
Back if there are errors.
If (results.length > 0)
return results;
If the input value contains no value,
Issue a validation error.
If (! value)
{
Results.push (new ValidationResult (true null, 'NaN', "this field is required."));
return results;
}
If the input value contains a number, issue a validation error.
expression = \d/;
If (value.toString (*.search (expression)) > = 0)
{
Results.push (new ValidationResult (true, null, 'NaN', "numbers not allowed!"));
return results;
}
return results;
}
}
}
It works:
private void performValidation (): void {}
Import features. CustomStringValidator;
private var v: CustomStringValidator = new CustomStringValidator();
Set the property of the listener to the component
to display validation errors.
v.Listener = txt;
v.Validate (txt. (Text);
}
]]>
package includes
{
Import mx.validators.Validator;
Import mx.validators.ValidationResult;
SerializableAttribute public class CustomStringValidator extends {Validator
Set the table for the return value of doValidation().
private var: table of results;
Manufacturer.
public void CustomStringValidator() {}
Call the base class constructor.
Super();
}
Set the doValidation() method.
override protected function doValidation(value:Object):Array {}
Table of clear results.
results = [];
expression1 var: RegExp = new RegExp();
var expression2: RegExp = new RegExp();
Call the base doValidation() class.
results = super.doValidation (value);
Back if there are errors.
If (results.length > 0)
return results;
If the input value contains no value,
Issue a validation error.
If (! value)
{
Results.push (new ValidationResult (true null, 'NaN', "this field is required."));
return results;
}
If the input value contains a number, issue a validation error.
expression1 = \d/;
If the input value contains a special character, issue a validation error.
Expression2 = / ([a - z] +) | ([A-Z] +) /
If (value.toString () *.search (expression1) > = 0)
{
Results.push (new ValidationResult (true, null, 'NaN', "numbers not allowed!"));
return results;
}
If ((value.toString () *.search (expression1)< 0)="" &&="" (value.tostring().search(expression2)=""><>
{
Results.push (new ValidationResult (true null, 'NaN', "only letter characters allowed!"));
return results;
}
return results;
}
}
}
Tags: Flex
Similar Questions
-
Creating a custom string of text
I have 4 text boxes. They are events, city, Email and chain
If Las Vegas is entered in the City text box, I want the text box to a string to read "City: Las Vegas.
If BK is entered in the event text box and Las Vegas entered the City text box, I want the text box to a string to read "Event: BK City: Las Vegas.
If [email protected] entered in the Email text box, and there is no data in the event, or the city of text boxes, I want the text box string read ' Email: [email protected] .
I can enter data into the string text box, but if one of the 3 text boxes is empty my text string box reads something like that ' event: Email: . " [email protected] City: '
If one of the event, city, and/or Email text boxes is empty, I don't want the text associated with the data will appear in the Srtring text box.
I'm a novice at javascript. Any help is very appreciated.
Ok. You must instead use the mouse upward, and could be replaced by the script:
Script mouse upward to a button
(function () {}
Get the field values as strings
sEvent var = this.getField("Event").valueAsString;
var sCity = this.getField("City").valueAsString;
var sEmail = this.getField("Email").valueAsString;
Get a reference to the output field
var fOutput = this.getField ("String");
var sOutput = "", aOutput = []; Initialize the production chain and table
Set the output array
If (sEvent) {}
aOutput.push ("Event:" + sEvent);
}
If (sCity) {}
aOutput.push ("City:" + sCity);
}
If (sEmail) {}
aOutput.push ("Email:" + sEmail);
}
Join the elements of the array into a string, separated by a space
If (aOutput.length > 0) {}
sOutput = aOutput.join("");
}
Set the value of the field on the output string
fOutput.value = sOutput;
})();
If you want it to happen automatically, you can use the custom calculation script next to the field "String".
Custom string field calculation script
(function () {}
Get the field values as strings
sEvent var = this.getField("Event").valueAsString;
var sCity = this.getField("City").valueAsString;
var sEmail = this.getField("Email").valueAsString;
var sOutput = "", aOutput = []; Initialize the production chain and table
Set the output array
If (sEvent) {}
aOutput.push ("Event:" + sEvent);
}
If (sCity) {}
aOutput.push ("City:" + sCity);
}
If (sEmail) {}
aOutput.push ("Email:" + sEmail);
}
Join the elements of the array into a string, separated by a space
If (aOutput.length > 0) {}
sOutput = aOutput.join("");
}
Set the value of this field to the output string
Event.Value = sOutput;
})();
-
I have the following script that I used for a PDF form in Acrobat X, but it does not work when I get it in the Javascript in the ES2 Editor. Is it possible to create a script that does the same thing in LiveCycle Designer ES2? I want to let the user enter a date using numbers only, and have the scope to add slashes if necessary, in addition to the validation of a suitable date. Thanks for any help.
Validation of date Acrobat
Custom validation Java Script for entering dates using only numbers
courtesy of Ricardo Falegnami
adding of slashes
var PROMOTIONDate = event.value;
validate date
If (PROMOTIONDate! = "") {/ / process non-empty string}
var mydate = [];
mydate [0] = util.scand ("DDMMYYYY", Nouvelle_date);
mydate [1] = util.scand ("MMDDYY", Nouvelle_date);
mydate [2] = util.scand ("mddyyyy", PROMOTIONDate);
mydate [3] = util.scand ("mmdyyyy", PROMOTIONDate);
mydate [4] = util.scand ("mdyyyy", PROMOTIONDate);
mydate [5] = util.scand ("mdyy", PROMOTIONDate);
isDate var = false;
for (var i = 0; i < oMyDate.length; i ++) {}
If (mydate [i]! == null) {}
Event.Value = util.printd ("mm/dd/yyyy", mydate [i]); strict format
isDate = true;
break;
}
}
Stay in the field if invalid
If (isDate = false) {}
App.Alert ("Invalid date entered - Please use DDMMYYYY (for example, 10152014)", 0, 1, "Date of Validation" "); check the validity
Event.Value = "";
event.target.setFocus ();
}
}
Hello
I'm guessing that you put this in the case of the field output. If so, replace the three occurrences of event.value to this.rawValue and the event.target.setFocus () at xfa.host.setFocus (this)
Concerning
Bruce
-
Show a custom before validation on Form Message ~ ~ Custom.pll / Personalization
Hi all
We have a requirement where we need to display custom before form validation using form customization message is or Custom.pll. I've tried a few things on VALIDATE to the relaxation TIME, is showing the message several times.
Any help will be greatly appreciated.
Thank you
gt1982
Published by: gt990 on August 2, 2011 10:52Personalization you cannot access to the events of validation, then you won't be able to use it for your condition.
A when-validate-record trigger fires for each new record was changed and so will be shown several times.If you are using forms of MFC, you can capture the event VALIDATION POST-FORMS using the HRMS custom.pll.
Otherwise, it is not possible.
Hope this helps,
Sandeep Gandhi -
Hi all!
Is it possible to create the session validation mechanism custom in consistency, which verifies the availability session in the third party system (Siebel in our case) and caching of data assigned to this session of external Web Services?
Thank you very much :)Coherence, supports HTTP Session caching through coherence * Web.
In terms of something similar for another session such as Siebel context may or may not be feasible depending on the nature of
cached in the session object, you are. You may use the mechanisms of coherence API standard and the application logic to manage session state
and he relates to other entities. -
To Webservice JSON string validation
Hi, I am a beginner, Blackberry developer and I would like help JSON string to a report Web service. I currently have the php pages that accept data in JSON format. Is there a way to do this? Any help would be appreciated. Thank you.
Hello
> showing the JSON string to a webservice
give this to start reading:
g
-
Change in length of custom string
Hello.
I need to change the length o a field custom_string in the call to the login screen.
Default value is varchar (30)
I also checked the change by changing a value in column of record of appeal to a String > 30 and made a request to verify that he had saved the long value.
So far so good.
Then I opened the call published in MSM and the time wherever I did (even before recording), the SQL value is truncated to 30 characters.
It seems as if the GUI has some built in the truncation. Audit of the field of screen Designer is not a mask (I also tested edit mask with more than 30 alaphanums (*)) and the field size is very large.
Any suggestions?PS, I haven't restarted the server given that current users of another VSM DB on the same machine.
Thank you
It is not necessary to restart the server in your case.
According to me, all you need is to analyze query files (in the VSM Server Console) and recycle the AppPool IIS VSM.
-
Problem with custom validation error message record
Hi, so I'm having a problem of application an error message customized a validator backup. I ran the following SQL scripts and updated the XML file as follows:
INSERT INTO commonXLAExtensionCache VALUES (' 1058811679F0-6F46-48FC - 9A 15 - 271EC9A7D0FQ ")
"ClassificationRequired", "ReflectiveRequiredValidator", "Validation rules")
INSERT INTO commonXLAExtensionCacheItem VALUES ('1059666651E8-A7F7-447-8CF5-8EE1F467C20Q',
"1058811679F0-6F46-48FC - 9A 15 - 271EC9A7D0FQ ', 0, 'RequiredPropertyMessage ',.
' Specification must have a ranking< rule type '6501' = >
< event condition 'save' = >
< if type = "ReflectiveRequiredValidator" report = "true" required = "true" property = "ProductAttributes.Classifications" msgcache = "ClassificationRequired" / > "
< / condition >
< / rule >
I get an error message:
Server error in ' / gsm' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and its origin in the code.
Exception details: System.NullReferenceException: Object Reference not set to an instance of an object.
Source of error:You have the stack trace in the error message? Assuming it's the cache:
Give a try instead and see if that solves it.
Delete the original entry and change the name and the inheritfrom of the ValidationMessages/ReflectiveRequiredValidator message cache, as follows:
INSERT INTO commonXLAExtensionCache VALUES (' 1058811679F0-6F46-48FC - 9A 15 - 271EC9A7D0FQ ")
"ValidationMessages/ReflectiveRequiredValidator", "ValidationMessages/ReflectiveRequiredValidator", "Validation rules")
-
Get the current language settings in the Custom Validation rule?
Hello
I read the book from Guide JDevelopers
"In 26.9' custom application Validation rules.
I ran the example to create custom Validation rules
I ran my validation rule for English and Italian language using 'Message Bundles'
I had EntityImplMsgBundle and EntityImplMsgBundle_it for the Italian language
The Question is:
Is it possible to get the current settings of the language used "get of in my custom validation class?
I need to know if the current language is 'in' or 'it '.
When I test my Applicaton of Module I can choose the configuration name: English EntityLocal and EntityLocalIT for the Italian language
Can I access this validation custome bean?
Kind regards.Hello
Yes, you can access the local current in your validation rule by accessing the current session through the source of the entity object DBTransaction object. This is done by calling:
((EntityImpl)valCtx.getSource()).getDBTransaction().getSession().getLocale()
HTH,
Patrik -
How to read the custom file Jad jad attributes?
Hi all
Please help me.
I need to read the custom JAD JAD attributes frm file.
I use this code
"
AllGroups [CodeModuleGroup] is CodeModuleGroupManager.loadAll ();.
CodeModuleGroup myGroup = null;
String moduleName = ApplicationDescriptor
.currentApplicationDescriptor () .getModuleName ();for (int i = 0; i)< allgroups.length;="" i++)="">
If (allGroups [i] .containsModule (moduleName)) {}
myGroup = allGroups [i];
break;
}
}Get the property
Var description As String = myGroup.getProperty("MIDlet-Description");
Custom string = myGroup.getProperty("My-Custom-JAD-Property");"
Copy the following code gives the 'description' string value, but NOTHING is coming when I read the string "Custom".
Let me know, where I'm wrong.
Kind regards
Ashutosh
Good to know that he has worked through the OTA.
4.2 versions below there is no workaround for it.
-
Help with Custom Signature Bulding
Can someone help me with this. I want to build a customized for the particular http string signature trigger.
http://150.50.15.110/MyApp?Data=01234567890&user=Joe
The goal is whenever the data attribute value is a 11 digit or more, it must trigger. Otherwise it should not. You must also use RequestRegex only. It is a laboratory of labops, but I've never had it work even with their solution. Every time I try to match a? (i.e-?) It does not work in the custom signature. When to use one. + It works.
I used the custom string to operate
[gG] [eE] [tT] [\x20]/[mM][yY][aA][pP].+DATA=. {11}, \&USER
Every time I replace the. + be with? or------? [+ or -?] or [-?] + or (-?) or (-?) + it does not work. I'm missing something. I spent over 40 hours and finally gave up.
I use s97 4.1 (4) and a 4215. My computer is running in a Bug.
Fires in the following regular expression:
[gG] [eE] [tT] [\x20]/[mM][yY][aA][pP][pP][\?] DATA =. {11}, \&USER
Your regex is missing from the second "P".
-Jason
-
DRM function to replace the comma in a string
Hello
I'm new to the DRM. I have a requirement to replace insérent in a string with the semicolon (-). Is it all built in function to achieve.
For example -.
input string is s1, s2, s3
Output string should be s1, s2, s3.
I tried to use the ReplaceStr function. This works well for replacing any other, but for the comma, it does not work.
Appreciate your help.
It works for me with the formula below to do a global search of replacement that uses properties to store the string the comma (s) must withdraw and a global property to contain the decimal point itself:
ReplaceStr (PropValue (Custom.String), (Custom.Comma) PropValue,, T)
You've been do not add commas directly in the formula contained in the definition of the property you have? That would by way too many parameters in the function when the formula is analyzed for you would end up with something like ' DRM-25620: number of parameters for the function "ReplaceStr" invalid. " 4 expected, found 5. »
Concerning
Craig
-
Hello people: Oracle Database 11 g Express Edition Release 11.2.0.2.0 - Beta - App Express 4.0.2.00.08
Small question:
I have a (very basic) custom authentication scheme and would like to know the following: where is the best place to put a posting on a password so that it complies with certain criteria (1 character special, minimum 8 digits, etc., etc.). In the function below? Or it is easily possible via a custom validation?
It is easy to achieve using application express accounts version 4.0.2.00.08 with integrated password requirements. I'm just trying to understand how to do it using custom rendering validation.
Any suggestions?
create or replace function "my function" (p_username in VARCHAR2, p_password in VARCHAR2) return BOOLEAN is l_password varchar2(4000); l_stored_password varchar2(4000); l_expires_on date; l_count number; begin -- First, check to see if the user is in the user table select count(*) into l_count from my_users where CLOCK_NUMBER = p_username; if l_count > 0 then -- First, we fetch the stored hashed password & expire date SELECT PASSWORD, EXPIRES_ON INTO L_STORED_PASSWORD, L_EXPIRES_ON frommy_users where CLOCK_NUMBER = p_username; -- Next, we check to see if the user's account is expired -- If it is, return FALSE if l_expires_on > sysdate or l_expires_on is null then -- If the account is not expired, we have to apply the custom hash -- function to the password l_password := custom_hash(p_username, p_password); -- Finally, we compare them to see if they are the same and return -- either TRUE or FALSE if l_password = l_stored_password then return true; else return false; end if; else return false; end if; else -- The username provided is not in the my_USERs table return false; END IF; end;
Are the passwords for the users of the application or for users of the database? If they are in fact the Basic users, the nor would go with suggestion of Ed to use a version of the example of validation attached to the profile feature.
If they are users of the application (in other words, no corresponding database user), then the validation belongs to your front-end, where users can set or change their passwords. There is no need to enforce rules on each connection, just the password complexity.
Furthermore, your function can be simplified to something like:
Create function check_login (p_username in VARCHAR2,
p_password in VARCHAR2) return Boolean is
number of l_valid;
Start
Select 1 from l_valid
from my_users where clock_number = p_username and
password: = custom_hash (p_username, p_password) and
(expires_on > = sysdate or)
expires_on is null);
Returns true
exception
When no_data_found then
Returns false;
end;
John
-
Custom calculation script - default value
Hi, I would like that the field 'A' a calculation whenever the field "B" changes its value after this 'A' becomes editable for the user. If "B" changes its value at any time, then 'A' clears any value, calculated and becomes editable for the user. As a default value.
You must use the custom b validation script to do the math. That change in a way a field will update when the value of B, but you will still be able to manually change A. To access the value of B, in this case use event.value, for example:
this.getField("A").value = event.value * 2;
-
I understand that you can go under the Format tab and select the postal Code or Zip Code + 4, but I was wondering if there was a javascript validation method that would either or in the same text field? Which means, the text field may allow only a regular postal code or Zip Code + 4. Also, no letters allowed as well. I appreciate your help in advance!
This can be done using JavaScript. For example, you can use this code as a custom field validation script:
if (event.value) { event.rc = /^\d{5}$/.test(event.value) || /^\d{5}-\d{4}$/.test(event.value); if (!event.rc) app.alert("Error message goes here"); }
Maybe you are looking for
-
Battery not charging on Satellite Pro L300D
I've had this laptop about four months and had just returned a repair under warranty (replacement of the motherboard). He had light use since I bought it. On his return, I ran a Windows 7 upgrade as installation clean but noticed that the battery cha
-
can I install the CD for printer on another computer/laptop that I installed it in the first cp
Photosmart d110 series running windows 7
-
How do I open a Zip file (such as a templete) so I could see it?
I have downloaded file open zip open so I could use them as a templete store. Please help me I'm lost.
-
Burned DVD will not play on a DVD player
I downloaded a 22 minute video I want to burn to a DVD in my DVD player. I tried on the DVD-R and DVD + R. They burn the disk but will not play on the DVD player. The error message indicates that the reading is not available on this disc. I used
-
I have a Dell Latitude E6430, which is more frequently having the BSOD. What tends to happen randomly when the laptop is open. I watched the minidump file and he said that there was a failure to state what is logical since the laptop goes from closed