Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

onchange Javascript not working in APEX

DooliusJul 2 2014 — edited Jul 7 2014

I have a mass modification form element (date picker) with the following code in the HTML Form Element Attributes box:

onChange="if( isDate3(this.value)==false){ this.value=''};"

The function being called is (Which is in the HTML Header text area of the HTML Header and Body Attribute section):

function isDate3(givenDate){

//alert(givenDate)

    

     //Check to see if the givenDate is not null before checking

     //the date format.

     if (givenDate != '') {

        if (getDateFromFormat(givenDate, 'MM/DD/YYYY')==0 ){

          alert("Please enter a valid date in the format: MM/DD/YYYY");

       return false;

        }

     }

     return true;

   }

However, when I change the value of the date picker, to "test" for example, no alert is given.

I added the code:

function sayhello()

{

alert("Say Hello");

return true;

}

and changed the call to:

onchange="sayhello();"

and it worked fine.

Anything wrong with my code to cause the first function not to work?

I have other code that doesn't seem to work as well:

function setColor()

   {

     var obj = document.getElementById("SUBMIT");

     obj.style.backgroundColor="yellow";

   }

This call is in the Element Attribute text box for the Tabular Form Element. When changed it is supposed to highlight my SUBMIT button which has a "Button Name" of SUBMIT:

onFocus="savedData=this.value;" onChange="if(isDate3(this.value)==false){this.value=savedData} else if (savedData != this.value){setColor()};"

Thanks

Steven

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 4 2014
Added on Jul 2 2014
4 comments
1,161 views