Custom validation & IsNumber javascript

Hi
How can we add custom validation in the "Edit an element" on Portal9as
By example to validate that the new image file name is unique
How can we use the IsNumber javascript from the shared objects
Can we add custom validation when we create new attribut and/or new element ?
Thanks
Jacques
Message was edited by:
user510720

Hi Doug
No offense taken.
You can choose to agree or not. It really doesn't matter. And I'm not trying to be rude either. Only trying to state the facts as I know them to be.
One way to easily have you see what I mean is by trying the following:
Generate Captivate as a SWF with an HTML page and enable the Full Screen option.
When the Full Screen option has been used, you get a second HTML page. When you run that second HTML page, you simply see a link that allows you to open the Captivate output in a larger windows devoid of toolbars and such.
Now, close the browser and locate the Captivate output files on your hard drive. Open the HTML page that presents Captivate. You should see that the Exit button either fails with no message (Chrome or Firefox) OR presents a message that the page is trying to close (IE). The net result is that the page simply doesn't close.
Now launch the page containing the link to open in full screen. You get just a link. You click the link and a new window appears. In that new window, you should be able to easily close the Captivate using the Exit button. This is because the Captivate output was opened in a child window. And from this, you should see that it's browser behavior that controls the ability to close. Captivate's doing all it can do by simply issuing a command to close the window. It's then up to the browser to allow that to happen. And it's all in the way the browser window was opened to begin with that controls it.
I cannot speak to other applications and their ability or perceived ability to close windows. There are lots of variables and it's quite possible they were dealing with the windows in different ways.
Keep in mind that if you are testing locally off your C drive, the exit button may also fail due to Flash Player Security Settings and you may need to add the testing folder to the list of trusted locations for the Flash Player.
Cheers... Rick

Similar Messages

  • How do I clear a form text field during validation using JavaScript?

    I am just learning JavaScript and the Acrobat API.  I have a form created in adobe acrobat 9 standard (starting from an existing form in MS Excel).  There is a text field for a Social Security Number.  I have a custom format script and keystroke script and a custom validation script. I would like to add to the existing validation script, that if what is entered doesn't match the validation test, then clear out the field as in erase all the characters that were typed into the field.  I want this to happen no matter what.  So even if someone filled in a valid SSN number and then moved to the next field, but then went back to the SSN field and decided to change their entry and this new entry was "invalid" then clear out the field (do not revert to what was typed in the field originally, even though it was considered valid by the script).  (There is currently no default value for this field.)  Thank you inadvance for you help on this.
    Here is the current validation script:
    // only run when field not blank
    if (event.value != "")
    // RegExp for validation #########
    var re = /^(\d{3})(\d{2})(\d{4})$/
    if(re.test(event.value) == false)
    app.alert("Enter a 9-digit Social Security number with no spaces or special characters (e.g., 555555555). It will be converted to the format 555-55-5555.")
         //Here is where I've tried adding all of these lines, but none of them will clear out what is in the field
              //this.resetForm([event.target.name]);
              //event.target.value == "";
              //getField("SSN 1").value = getField("SSN 1").defaultValue;
              //getField("SSN 1").value == "";
              //event.rc = false;
    And incase these are somehow affecting it, here are the other scripts being processed on this field:
    Keystroke script:
    var input=event.value;
    var chars=input.length;
    if( event.willCommit || chars==8 )this.getField("Name 1").setFocus();
    Format script:
    var re = /^(\d{3})(\d{2})(\d{4})$/
    if(re.test(event.value) == true)
    // add "-"
    event.value = RegExp.$1 + "-" + RegExp.$2 + "-" + RegExp.$3;

    Thank you very much.  I did try that before, but I was using event.value == "";  I guess in this case I'm assigning the value of "", not making the value equal "".

  • ADF validator or JavaScript for client side validation ?

    using JDev and ADF 11g
    Problem description : To apply validations such as date range check, pattern matching, maxlength etc.. on ADF Faces Components.
    Solution 1: Use ADF validator such as Reg Expr validator, Max Length validator
    Souliton 2: Write Javascript code for validating the component's value at cleint side.
    When using ADF Validator for such type of validation checking, a request is send to the server for processing (additional overhead) . However we can do such validations with javaScript functions without the need to interact with the server. So, what benefit does ADF Validator serves when one needs to implement such validations ?
    Please share your views...

    H,
    afaik, client side validation in ADF Faces suppresses server round trips if a validation error is detected on the client. Only if no problem is found, the server side validation is challenged upon submit (so no extra round trip for validation). Shay is absolutely correct. JavaScript is a convenience but never a solution.
    Here's how to create a custom validator with a client and server side implementation : http://download.oracle.com/docs/cd/E15523_01/web.1111/b31973/af_validate.htm#BABEIIDD
    Frank

  • Customized prompts for javascript

    Hi all,
    I have used javascript for some simple client side validations in JSF.. I want to achive internationalization. how do i give customized alerts in javascripts?
    e.g for german language , error message shud be in german language. how do i specify them in properties file and how to specify them on javascript alerts ??
    Thanx in advance

    Example:
    Jus alter
    <h:commandButton onclick="return confirm('Are you really sure?')" />
    To:
    <f:loadBundle var="bundle" basename="path.to.your.Bundle" />
    <h:commandButton onclick="return confirm('#{bundle.key}')" />
    Regards
    Thomas

  • Pop up error messages for failed custom validation

    I am using jdev-10.1.3.4
    My application is in ADF BC
    I am writing custom validation through managed bean, I want pop-up error message for this failed validation.
    My problem scenario is:
    I had some list box as "status"-when this status changes to failed then the other field namely "closed date" should become madantory and also date in closed date field can't be in future.I am able to have all this validation through managed bean and also able to use af:messages through which i am able to print error message on the top of the form, but i am not able to give pop up error message for this failed validation.
    I had gone thru jdev guide but there is nothing like what i am asking.
    it would be of great help if someone can give me some example also.
    thanks in advance.

    ADF has global setting where you can configure the way messages are shown to user:
    You can make this setting in adf-faces-config.xml
    The <client-validation> element controls how client-side converters and validators are run.
    Three values are supported:
    "INLINE": validation is shown inline in a page (the default)
    "ALERT": validation is shown in an Javascript alert
    "DISABLED": validation is only handled on the server
    IN your case, set it to 'ALERT'.

  • How to get values from a table(in jsp) for validation using javascript.

    hi,
    this is praveen,pls tell me the procedure to get values from a table(in jsp) for validation using javascript.
    thank you in advance.

    Yes i did try the same ..
    BEGIN
    select PROD_tYPE into :P185_OFF_CITY from
    magcrm_setup where atype = 'CITY' ;
    :p185_OFF_CITY := 'XXX';
    insert into mtest values ('inside foolter');
    END;
    When i checked the mtest table it shos me the row inserted...
    inside foolter .. Now this means everything did get execute properly
    But still the vallue of off_city is null or emtpy...
    i check the filed and still its empty..
    while mtest had those records..seems like some process is cleaining the values...but cant see such process...
    a bit confused..here..I tried on Load after footer...
    tried chaning the squence number of process ..but still it doesnt help
    some how the session variables gets changed...and it is changed to empty
    Edited by: pauljohny on Jan 3, 2012 2:01 AM
    Edited by: pauljohny on Jan 3, 2012 2:03 AM

  • 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,
    Kamil

    Hi 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
    Tilemahos

    since 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?
    UZ

    I 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,
    Sudheesh

    If 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

  • 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
    Keith

    Hi 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 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 thanks

    Does 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, thanks

    I 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,
    Suhani

    Why 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

  • Pre-validation using JavaScript cannot work in JSF?

    Sometimes we need to do pre-validation using JavaScript in some senarios that data need be entered and validated at client site before it reaches to Web Application Server. Remind that JSF is a server validation. Creator seems not to allow Developers to do pre-validation using JavaScript for any editable input fields in form. I will illustrate an example and hope anyone can help me to solve it out.
    Assume that if we write the a new web page that allows User enters Name and Phone. The pre-validation function called test() is written in JavaScript for validating field Phone. For simplicity, the below HTML/JavaScript without nested in table is a simple one for HTML form.
    <html>
    <body>
    <script language="JavaScript">
    function test(){
         if (form1.phone.value == "")
              alert("Please enter phone number in digits.");
              return false;
    </script>
    <form name=form1>
    <input id="phone" type="text" size=20><Br>
    <input id="name" type="text" size=20><Br>
    <input type="submit" id="submit" onclick="test()" value="Submit">
    </form>
    </body>
    </html>
    Now, we consider using Java Studio Creator to generate the same form as describing above. The script is shown below:
    <?xml version="1.0"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <html>
    <head>
    <title>testForm Title</title>
    </head>
    <body rave-layout="grid">
    <h:form binding="#{testForm.form1}" id="form1">
    <h:inputText binding="#{testForm.textField1}" id="phone" style="position: absolute; left: 192px; top: 96px; width: 168px; height: 23px"/>
    <h:inputText binding="#{testForm.textField2}" id="name" style="position: absolute; left: 192px; top: 144px; width: 168px; height: 23px"/>
    <h:commandButton binding="#{testForm.button1}" id="submit" style="position: absolute; left: 192px; top: 216px" value="Submit"/>
    </h:form>
    </body>
    </html>
    </f:view>
    </jsp:root>
    After running Script that Creator created, the HTML is generated and reduced (for simplicity) as follows:
    <f:view>
    <html>
    <body rave-layout="grid">
    <form action="/rave/rave" id="form1" method="post">
    <input id="form1:Phone" type="text"></input>
    <input id="form1:name" type="text"></input>
    <input id="form1:button1" value="Submit" onClick="test()"></input>
    </body>
    </html>
    </f:view>
    Take a look carefully at <input> elements. We see the syntax for naming for each "input" element that there is a semi colon added between form1 and phone or form1 and name. This syntax is generated from built-in JSF components. Hence, I rewrite the test() JavaScript function to match with the naming that Creator generated as follows:
    <script language="JavaScript">
    function test(){
         if (form1.form1:Phone.value == "")
              alert("Please enter phone number in digits.");
              return false;
    </script>
    Clearly, this JavaScript cannot be worked because of a semi column that Creator has named it.
    I have tried to work arround for this but cannot find a solution except changing the name such as: from <input id="form1:phone" ...> to <input id="form1_phone" ..>. But I could not change or modify the scripts because it is generated from JSF components when running it under browser.
    I guess to solve this problem, the naming for elements in form should be reconsidered in the next release of Java Studio Creator.

    Hi Marie,
    I currently sucess in client pre-validation using JSF. I found a way to do it.
    Please take a look of how javascript has been added in the following scripts:
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <html lang="en-US" xml:lang="en-US">
    <head>
    <meta content="no-cache" http-equiv="Cache-Control"/>
    <meta content="no-cache" http-equiv="Pragma"/>
    <title>login Title</title>
    </head>
    <body style="-rave-layout: grid">
    <h:form binding="#{login.form1}" id="form1">
    <h:outputLabel binding="#{login.componentLabel1}" for="componentLabel1" id="componentLabel1" style="position: absolute; left: 216px; top: 72px">
    <h:outputText binding="#{login.componentLabel1Text}" id="componentLabel1Text" value="Application System Name"/>
    </h:outputLabel>
    <h:panelGrid binding="#{login.gridPanel1}" columns="3" id="gridPanel1" style="position: absolute; left: 72px; top: 168px; width: 504px; height: 100px">
    <h:outputLabel binding="#{login.componentLabel2}" for="componentLabel2" id="componentLabel2">
    <h:outputText binding="#{login.componentLabel2Text}" id="componentLabel2Text" value="User Name: "/>
    </h:outputLabel>
    <h:inputText binding="#{login.textField1}" id="textField1" onclick="" style="width: 149px; height: 22px"/>
    <h:outputText binding="#{login.outputText1}" id="outputText1"/>
    <h:outputLabel binding="#{login.componentLabel3}" for="componentLabel3" id="componentLabel3">
    <h:outputText binding="#{login.componentLabel3Text}" id="componentLabel3Text" value="Password: "/>
    </h:outputLabel>
    <h:inputSecret binding="#{login.textField2}" id="textField2" style="width: 147px; height: 22px"/>
    <h:outputText binding="#{login.outputText2}" id="outputText2"/>
    <h:outputLabel binding="#{login.componentLabel4}" for="componentLabel4" id="componentLabel4">
    <h:outputText binding="#{login.componentLabel4Text}" id="componentLabel4Text"/>
    </h:outputLabel>
    <h:commandButton action="#{login.ok_action}" binding="#{login.button1}" id="button1" onclick="return checkUserIdentity(this.form)"
    style="width: 90px; height: 25px" value="OK"/>
    <h:outputLabel binding="#{login.componentLabel5}" for="componentLabel5" id="componentLabel5">
    <h:outputText binding="#{login.componentLabel5Text}" id="componentLabel5Text"/>
    </h:outputLabel>
    </h:panelGrid>
    </h:form>
    </body>
    <script type="text/javascript">
    function checkUserIdentity(form){
    var userName = form["form1:textField1"].value;
    var userPassword = form["form1:textField2"].value;
    if (userName == "") {
    alert("Please enter User Name.");
    form["form1:textField1"].focus();
    return false;
    if (userPassword == "" ){
    alert("Please enter password.");
    form["form1:textField2"].focus();
    return false;
    form.submit();
    return true;
    </script>
    </html>
    </f:view>
    </jsp:root>
    The key for getting data value from Form based on Javascripts is var userName = form["form1:textField1"].value;
    Thanks,
    VTT_

Maybe you are looking for