Custom validation against an array
I need write a custom validator to validate an Input field against an Array to make sure that the entered value is NOT in that array. How do I
pass the Array into the Validator as a variable so that I can compare the Input with the Array when a button is click? Thx.
If your custom validator has a public variable validationArray then you can pass the dynamic array as follows:
myCustVal.validationArray = myArr;
And then you should be able to do as we suggested in the functions of the validator.
If this post answers your question or helps, please mark it as such. Thanks!
http://www.stardustsystems.com
Adobe Flex Development and Support Services
Similar Messages
-
How do you create custom validation rule in WS 9.2?!?!?!
Hello,
I am using Workshop 9.2. I created a page flow, and want to do some form validations.
I saw the simple 9.2 example, but it is only good for very basic validation, what if you have to validate the form field against a database, must you write a custom validation rule? HOW would you do this in 9.2 so that will still stay with the workshop/netui paradigm?
http://beehive.apache.org/docs/1.0.1/netui/validation.html
KeithHi Keith,
Staying within the declarative validation framework the answer is probably that you do need to write a custom validation rule and refer to it using the @Jpf.ValidateCustomRule annotation.
The NetUI Annotation Reference shows how the Struts validations are supported via the framework.
http://beehive.apache.org/docs/1.0.1/netui/annotations/pageflow_annotations.html
Specifically, if you look through the @Jpf.Validate* annotations, while most of these are "canned" common validations, there are a few that are more open-ended, such as @Jpf.ValidateMask and @Jpf.ValidateValidWhen.
Those two let you write the validation logic in the annotation while @Jpf.ValidateCustomeRule only refers to a custom rule in the struts validator file.
In any case, there is a validation rule editor which should help in authoring and managing the annotations. In the Page Flow Explorer or Page Flow Editor just right click on the action or form bean bean of interest and choose Validation Rules and the appropriate scope.
I hope that's of some use,
Troy -
Custom validator for a SelectMany component
I did not succeed at validating a selectManyCheckBox with a custom validator.
I want to validate that the user selected at least 1 and at most 3 checkboxes.
The UIComponent.getSelectedValues always returns an array of length 0, even when some boxes are checked.
Page code:
<h:selectManyCheckbox id="selectProfessions" value="#{userBackingBean.selectedProfessionIDs}" layout="pageDirection" styleClass="category">
<f:selectItems value="#{categoryTreeBackingBean.professionSelectItems}" />
<f:validator validatorId="com.studio184.news.ui.validator.SelectCategoriesValidator"/>
</h:selectManyCheckbox>
Validate method:
UISelectMany select = (UISelectMany)component;
if (select.getSelectedValues() == null || select.getSelectedValues().length < 1 || select.getSelectedValues().length > 3) {
String summary = ...
String detail = ...
FacesMessage message = new FacesMessage(summary, detail);
message.setSeverity(FacesMessage.SEVERITY_ERROR);
throw new ValidatorException(message);
Any help would be greatly appreciated.
Bruno
http://www.practicalsoftwarearchitect.comIn general, the value property is set at the end of the Process Validations phase.
You can use getSubmittedValue() to access the submitted values.
More simply, you can use the third argument of the validate method which is the same as the submitted value.
For example:
public void validate(FacesContext arg0, UIComponent arg1, Object arg2)
throws ValidatorException {
Object values[] = (Object [])arg2;
if (values() == null || values().length < 1 || values().length > 3) {
// throw exception!!
} -
Buying Group / End Customer Validation in Trade Management
Hi All,
I need to validate a buying group and one of its member as End Customers against an agreement in POS. Does anyone know a way of acheiving this objective ?
Eg:
Manf = M
Disti = A
Buying Group = BG
End Customer = EC
EC is a member of BG. Disti A sends a contract record in POS, which BG has with M and reports a sale to EC. So when processing the POS line, the EC-BG combo has to be validated against the contract. The Contract Type (Agreement Type) I am using is Pricelist and BG buying group is added as a qualifier in the Pricelist.
ThanksHello Woz2000,
I'm very disappointed to read that your recent visit to the Hartsdale store has resulted in such feelings. What you describe is not the superior level of service to which we aspire, and I very much regret that we've not lived up to that ideal for you.
I presume from your message that you did not speak to a manager during your recent visit. If you wish, I can work on your behalf with the store's leadership to help rectify this situation, and I'm happy to do so. If you' please send me a private message with your preferred contact information, I'll get in touch with the store managers.
Thank you for bring this to my attention and for sharing your experience with us.
Sincerely,
John|Social Media Specialist | Best Buy® Corporate
Private Message -
Pre-defined validator vs Custom validator
I have a requirements where I need to validate previous version of material spec whether it is appoved or not. If not, then do not allow any user to create new version of that material spec. Wondering if this can be achieved using our pre-defined validator or should we go with custom validator.
Thanks
JosephSince the current specification does not have a property holding the previous versions of the specification, you have to look that up yourself through a database query. A custom validator would be your only option to do this.
You have to retrieve specs from the specSummary table where the specnum is the same but the issuenum is less than (<) the current spec's issue num. If you retrieve those SpecID values, you could then use the DataManager.objectFromID method to load each spec, and then use the helper class SpecWorkflowTagEvaluator from EP2.5's PLM4PExtensionUtils to check if any of them is marked as Approved (or pass the workflow tag behavior id).
Alternatively, and probably more efficiently, you could write the SQL where you also join against the workflow tags to determine if there are any. The following shows some of the sql, though you would have to write the rest (checking the spec number and issue number..., etc.)
SELECT * FROM SpecSummary s
INNER JOIN gsmWorkflowActivityTemplates iwat ON S.fkProcessTemplate = iwat.fkProcessTemplate AND S.SpecStatusID = iwat.fkWorkflowStatus
INNER JOIN GSMWFExtendedBehaviorJoin exj ON exj.fkGSMWorkflowActivityTemplate = iwat.pkid
INNER JOIN comLWFExtendedBehaviorTemplate beh on beh.pkid = exj.fkExtendedBehavior and beh.BehaviorID = 4 -- 4 is Is Approved - you can join against comLWFExtBehaviorTemplateML to get the tag names -
Perform custom validation on invoices created via iSupplier portal in R12
Hello,
It seems that since R12, invoices created on iSupplier portal are no longer loaded via Payables open interface tables (while ASBN's still are). It is nice that they are loaded immediately but now we do not have any way to perform custom validation that we normally do via AP_INTERFACE_WORKFLOW_PKG.do_custom_validation procedure.
Is there any way to modify how iSupplier portal inserts Invoice data into AP tables? In particular we would like to choose specific document category for certain suppliers.
Many thanks in advance,
KamilHi Friends,
Apologies to have put this in SCM-Costing Category. I just posted the same thing in Financials Category.
Please ignore this, if found irrelevant under this category.
Thanks,
AAR -
Problem with custom validated data types using domain on 11g
Hi,
I ' m on a migration process from 10 to 11 and I notice that a custom domain didn't work correctly anymore
to be more specific every time that I was submiting a page a was getting an error cannot convert from myclass to oracle.jbo.domain.String
I search the forum and I saw a similar problem
Cannot convert type class java.lang.String to class oracle.jbo.domain.Clob
at which Frank says that it is a known bug and suggests a work around.
I use the workaround and it worked but some more issues came up:
1. If the validation fails I get the error that I throw at the validate method not in a popup with just my message
but in the whole window with the whole error stack, meaning that my custom validation is not handled like native ADF validation errors by
the framework (at 10.1.3.4 worked OK)
2 If i dont give a value at the attribute in the validation phase mdata variable is not null but is length is zero (at 10.1.3.4 its value was null)
public class AFM implements DomainInterface, Serializable {
public AFM(String val) {
mData = new String(val);
validate();
private String mData;
protected void validate() {
// ### Implement custom domain validation logic here. ###
mData==null // returns false
mData.length()==0 // returns true
3. Can i force validation only for new or updated values? I saw that the validation process is taking place every time a row is fetched.
This is not only a performance issue, the bigger problem is that if a fetched from the DB value fails the validation an error is return but the
user cannot change the value to correct it.
TIA
Tilemahossince i don't get any answer I wonder if i should have use a more provocative title like
"custom domains in 11g don't work"
is it true?
Tilemahos -
Custom Validator Class not found in Class Path
I have developed a custom validator class for User Self Registration request. However, when OIM is unable to find the custom validator class and generates teh following error:
[oracle.iam.platform.pluginframework] [tid: [ACTIVE].ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: oiminternal] [ecid: 76584c4849877d50:-45bb4068:13c8294bd72:-8000-0000000000001236,0] [SRC_CLASS: oracle.iam.platform.pluginframework.InternalStore] [APP: oim#11.1.1.3.0] [SRC_METHOD: getPluginInstance] Not able to load class com.infotech.tra.CustomValidator.SelfRegisterUserCustomValidator from classpath
At what path should the jar file be placed?
UZI am running the plugin registration utility but it generates the error mentioned below. I have verified the structure of my zip file and the structure of zip file is:
-> SelfRegisterUserCustomValidator.zip
->Plugin.xml
->/lib/SelfRegisterUserCustomValidator.jar
->/resources/
Following our contents of plugin.xml:
<?xml version="1.0" encoding="UTF-8"?>
<oimplugins>
<plugins pluginpoint="oracle.iam.request.plugins.RequestDataValidator">
<plugin pluginclass= "com.infotech.tra.CustomValidator.SelfRegisterUserCustomValidator" version="1.0.0" name="SelfRegisterUserCustomValidator">
</plugin>
</plugins>
</oimplugins>
Following is the error being generated:
Enter name (complete file name with path) of the plugin file:
/u01/oracle/Middleware/Oracle_IDM1/server/plugin_utility/SelfRegisterUserCustomValidator.zip
[java] Java Result: 1
[echo] Exception in thread "main" java.lang.NoClassDefFoundError: oracle/iam/platformservice/utils/PluginUtility
[echo] Caused by: java.lang.ClassNotFoundException: oracle.iam.platformservice.utils.PluginUtility
[echo] at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
[echo] at java.security.AccessController.doPrivileged(Native Method)
[echo] at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[echo] at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
[echo] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
[echo] at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
[echo] Could not find the main class: oracle.iam.platformservice.utils.PluginUtility. Program will exit. -
Custom validation Messages printed more than once :-(
Hi,
I have added a Custom Validator to a drop down list box (h:selectOneMenu) and for a text field. and i bound these form elements to the corresponding UIComponent Object in the becking bean. The backing bean is in session scope I have a link which will forward to a different page and i disabled the validation on this link by setting immediate as true.
But when the user clicks the command link goes second page and then comes back to the first page and click the submit button, the validation error occurs. But to my surprise i am getting the same Validation error message printed twice or thrice (as when we are going to the second page and then comes back and submits).
If I am correct the Validator corresponding to the component keeps the old error state and then add the new error state.
I tried to remove one FacesMessage object which i got from Iterator of FacesContext.getMessages() and then tried. but hence also i was getting the same result.
When i looked at the log, i foud my validator class being invoked twoce (or thrice depending upon the no. of times i went to the secoond page).
Can you please help me out from this problem?
Thanking you,
SudheeshIf it is indeed 1.1, I'd recommend trying 1.1_02 [1] and trying again.
[1] https://javaserverfaces.dev.java.net/servlets/ProjectDocumentList?folderID=5225&expandFolder=5225&folderID=5220 -
Customer payment against invoices
Dear friends .
Please suggest me that is there any report in FI for customer payment against invoices
Customer No Name Company Code Fiscal Year Invoice No Invoce Posting Date Invoice Amount DZDoc No DZ Amount DZDoc Posting Date Planned Cash Discount Amount Actual Cash Discount Amount Short Payment Assignment Sales Office Profit Centre Clearing Document Clearing Date Base Line Date Net Due Date Days Interest Rate Interest Amount Terms Of Payment
I will be highly thank full to you all.
Please help me .
yours
viveksir , thanks for your valuabel suggestion but problem is there are so
amy fileds that are based on Amount DZ Amount CD Amount
and rest are missing .
Please suggest some FI based report for the same.
yours
vivek -
Using XSL on XML validated against XSD
Transforming XSD validated XMLType Data
Re: example XSL in Chapter 6 that transforms XML with associated XSD schema definition (Oracle 9i XML Database Developer's Guide)
I noted that this XSL uses only the "general" node identification functions (e.g., name() ) to access nodes in the <xsl:value-of select..>. I have also noted that standard XSL templates from other sections of the documentation, for example in Chapter 3 and in Appendix D, do not work with an XML which is validated against an XSD schema.
Can anyone give me an example <xsl:value-of select..> that addresses a specific node in the "purchase order" example, like the shipTo, name, street -- or any other specific node. This is critical since there is always bound to be node-specific processing in any transformation, and this is not demonstrated by any example of XML which has been validated against an XSD.
I have tried this endlessly on my own examples of XML w/XSD validation. Even if the value-of select="name(.)" tells you that the name of the node is "FooBar", you cannot use FooBar as a select test to do FooBar specific processing.
Help?????Not quite understand your question. Can you send me the example doc?
-
Custom Validator for a Custom Component
I am having troubling passing values from my custom component
to my custom validator (via a model). For some reason when the
validate() function is called for the validator the value parameter
passed to the validator is not showing the value from my custom
component.
I have attached some example code to illustrate.
Here is my model:
<mx:Model id="myModel">
<root>
<mod>
<name>{myTextInput.text}</name>
<date>{myDateField.selectedDate.getTime()}</date>
<length>{myComp.getLength()}</length>
</mod>
</root>
</mx:Model>
When I update the value of myTextInput or myDateField the
model (as sent to the validator) shows the correct value. When I
change the value of myComp the change is not reflected.
Is there a particular event (or something) being dispatched
in the other components to cause the model to get the new value
that I need to include in my custom component? I am pretty stuck
and would appreciate any help.
Many thanksDoes myComp extend EventDispatcher (or any class which does)?
You need to flag the getLength() function as bindable and to
dispatch an event:
[Bindable('getLengthChange")]
public function getLength() : Number
// does whatever it does
When you update myComp have it dispatchEvent( new
Event("getLengthChange") ) and I think it will work. -
How to use I18N with a custom validator?
This is my custom validator:
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException
Pattern pat=Pattern.compile(".+@.+\\.[a-z]+");
Matcher m= pat.matcher(value.toString());
if(!m.find())
FacesMessage message = new FacesMessage("Not a valid e-mail address");
throw new ValidatorException(message);
}Instead of providing the text "Not a valid e-mai address", I'd like to get the text out of my ApplicationResources property file.
How can I do this?
I know how to use it with the provided validators, but not with own custom ones
Please help me out, thanksI found a solution for this problem, I don't know it's best practice but here it is :
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException
String errortext;
Pattern pat=Pattern.compile(".+@.+\\.[a-z]+");
Matcher m= pat.matcher(value.toString());
if(!m.find())
ResourceBundle bundle =
ResourceBundle.getBundle("be.vdab.resources.ApplicationResources", context.getViewRoot().getLocale());
errortext = bundle.getString("erroremail");
FacesMessage message = new FacesMessage(errortext);
throw new ValidatorException(message);
} -
Can we apply custom validation before uploading data in WebADI in 12.1.3
Hi,
I have requirement of applying custom validation before uploading data from spreadsheet using webADI. How can we do that.
Is there any way in desktop Integration Manager Responsibilty in WebADI.
I have just started exploring webADI
Please Help Me...
Thanks,
SuhaniWhy are you posting this in OAF?
Anyway you can by creating a custom PL/SQL wrapper that is called by the WebADI.
Raise an application ERROR in your wrapper and it will show in the WebADI
If you just want to validated VALUES, you are better of creating an LOV on the Column. Then WebADI will do the validation work for you.
Jeroen -
Hi,
Does Oracle 8i (Release 3) support XML validations against XSD? I know Oracle 9i (Release 2) supports XML validations against XSD.
Also, Does Oracle support XML validations against XDR?
Any info is appreciated.
Thanks
PavanValidate with DOMParser or the SAXParser.
Maybe you are looking for
-
Sales Documents and Profit Centre and GL Accounts
Currently a when we create a sales document for a plant, that document is posting to a specific GL account (Cash on Hand account) and profit centre. In VKOA, the Account Assignment Group is assignment to a GL Account, and that AAG is assigned to the
-
LSMW field with 5 decimal points
Hi All, I need to pass a field in the LSMW with 5 decimal points. we cannot pass the data type as "PAC5". can any one suggest how this can be done in LSMW. Also, I am passing the currency key as USDN in the LSMW using Idoc method. But it is taking on
-
Big problem, Live Paint Bucket changing strokes
Hi all, so in the first picture you can see the finished line work. When I fill the face with a color in Live Paint, it changes the strokes and makes them appear jagged in varying widths, it's especially obvious on the eyes, ears, and hair - it looks
-
Placing an illustrator file in Indesign
I am wondering if someone would be able to tell me the best type of file to place in IDCS from Illustrator 10. There are photos, brushes, gradients, etc. in my ai file and when I place this file in CS the pictures and the brush strokes are all out of
-
ITunes and Quicktime not running after upgrade
After installing iTunes 5 I get the following error message when launching it: 'The instruction at "0xf4800000" referenced memory at "0xf4800000". The memory could not be "read".' When trying to run a quicktime clip embedded in a Acrobat document I g