Home » Developer & Programmer » Application Express, ORDS & MOD_PLSQL » Javascript not working for Firefox (Apex 3.2 )
Javascript not working for Firefox [message #488795] Tue, 11 January 2011 03:37 Go to next message
BBMamun
Messages: 94
Registered: February 2010
Location: Dhaka, Bangladesh
Member
Hi I have a simple text item validation function which works for MSIE, Google Chrome and Opera But it does not work for Mozilla Firefox.

My javascript function is as below:

function NumericValidation(pThis){
if (isNaN($v(pThis))){
alert('Value is not a valid number');
}
else if ($v(pThis)<=0){
alert('Must be a positive value!');
}
else {
1=1;
}
}


Any Idea..Please notify

Regards

Hasan Al Mamun
Programmer
Bangladesh Bank
Dhaka, Bangladesh
Re: Javascript not working for Firefox [message #488798 is a reply to message #488795] Tue, 11 January 2011 03:51 Go to previous messageGo to next message
Michel Cadot
Messages: 67297
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
This question bears no real connection with Oracle.
Please find a more appropriate forum.
The topic is locked.
If I'm wrong, please, PM me (or report this message to a moderator, explain why you think it should be unlocked and it might be done).

Regards
Michel
Re: Javascript not working for Firefox [message #488803 is a reply to message #488798] Tue, 11 January 2011 04:36 Go to previous messageGo to next message
Littlefoot
Messages: 21580
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Actually, as most of Apex pages do use Javascripts, I believe that Oracle and Javascript are very related to each other when speaking of Apex. We should look at it as if it was a question about running Oracle on different platforms. Only, now we are speaking about running Apex on different browsers.

Therefore, I unlocked the topic.
Re: Javascript not working for Firefox [message #488806 is a reply to message #488803] Tue, 11 January 2011 04:40 Go to previous messageGo to next message
Michel Cadot
Messages: 67297
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I didn't see the mention of Apex in the title and as the topic was posted in Java forum I didn't think about Apex.

Regards
Michel
Re: Javascript not working for Firefox [message #488812 is a reply to message #488806] Tue, 11 January 2011 05:02 Go to previous messageGo to next message
BBMamun
Messages: 94
Registered: February 2010
Location: Dhaka, Bangladesh
Member
I have mentioned Apex 3.2 in the tag below the topic name. Since I have posted it in the Apex forum and Oracle Apex deals with javascripts so I think topic is relevant. Yes javascript may have it's own forum, may be I should ask the question there as well, but I am talking about using javascript in Oracle Apex 3.2 using different web browsers. I need responses from people who work in Apex and faced the problem and solved it. That's why I posted the topic here.

Regards

Hasan Al Mamun
Re: Javascript not working for Firefox [message #488817 is a reply to message #488812] Tue, 11 January 2011 05:19 Go to previous messageGo to next message
Michel Cadot
Messages: 67297
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Anyway, you should post your question in a FF forum, there should be far more skilled people on it than here; we are more Oracle guys than Internet browser ones.

Regards
Michel

[Updated on: Tue, 11 January 2011 05:21]

Report message to a moderator

Re: Javascript not working for Firefox [message #488821 is a reply to message #488817] Tue, 11 January 2011 05:30 Go to previous messageGo to next message
BBMamun
Messages: 94
Registered: February 2010
Location: Dhaka, Bangladesh
Member
Hi, $v(pThis) is an Apex defined function. it will not work anywhere else same as it works here in apex. So Apex people can answer me here. I am hopeful for help in Apex forum.

Regards.

Hasan Al Mamun
Re: Javascript not working for Firefox [message #488838 is a reply to message #488795] Tue, 11 January 2011 08:36 Go to previous messageGo to next message
c_stenersen
Messages: 255
Registered: August 2007
Senior Member
I believe your problem is here:
else {
  1=1;
}


1 is a constant value, so it can't be assigned to anything. IE just overlooks the problem, but FF doesn't like it and refuses to run anything. (Tried it here on IE 8.0 and FF 3.6.)
Re: Javascript not working for Firefox [message #488876 is a reply to message #488838] Tue, 11 January 2011 22:56 Go to previous messageGo to next message
BBMamun
Messages: 94
Registered: February 2010
Location: Dhaka, Bangladesh
Member
Hi c_stenersen, thanks for your advice, I have re-written the function like this

function NumericValidation(pThis){
if (isNaN(document.getElementById(pThis).value )){
alert('Value is not a valid number');
}
else if (document.getElementById(pThis).value <=0){
alert('Must be a positive value!');
}
else {
var a = 1; //actually does nothing. it's a fake assignment.
}
}


Now it also works for Firefox. Thank you.

Regards

Hasan Al Mamun

[Updated on: Tue, 11 January 2011 22:56]

Report message to a moderator

Re: Javascript not working for Firefox [message #488891 is a reply to message #488876] Wed, 12 January 2011 01:07 Go to previous messageGo to next message
Michel Cadot
Messages: 67297
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Why don't you put something like the following instead of a fake assignment:
function NumericValidation(pThis){
  if (isNaN(document.getElementById(pThis).value )){
    alert('Value is not a valid number');
  } 
  else if (document.getElementById(pThis).value <=0){
    alert('Must be a positive value!');
  }
  // no else because <... here a meaningful comment for your application ...>
}

or if you are in the process of developping the procedure:
function NumericValidation(pThis){
  if (isNaN(document.getElementById(pThis).value )){
    alert('Value is not a valid number');
  } 
  else if (document.getElementById(pThis).value <=0){
    alert('Must be a positive value!');
  }
  else {
    // Normal case to be provided
  }

Regards
Michel
Re: Javascript not working for Firefox [message #488984 is a reply to message #488876] Wed, 12 January 2011 11:49 Go to previous message
Its_me_ved
Messages: 979
Registered: October 2009
Location: India
Senior Member
There are some in built functions in Apex which you can use:
Use $x('P1_TEXT').value instead of using document.getElementById('P1_TEXT').value

P1_TEXT is the text item created.

Regards
Ved

[Updated on: Wed, 12 January 2011 12:29]

Report message to a moderator

Previous Topic: Freeze Columns
Next Topic: End date greater than start date, but values can be null - how to code this
Goto Forum:
  


Current Time: Wed Aug 12 16:25:43 CDT 2020