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!

Special Character Alert *^%$

Charles AFeb 25 2010 — edited Mar 3 2010
Hello All,
I have to use an alert popup for this. Denes Kubicek has a sweet example that I have mimicked also in my actual application.
Section IV - Check Special Character
http://apex.oracle.com/pls/apex/f?p=31517:248:740097222962767::NO
I have created a JavaScript function that pops an alert if any of the specified characters are entered based on CREATE button click.
function charClassName()
{
  var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";

  for (var i = 0; i < document.getElementById('P3_CLASS_NAME').value.length; i++) {
  	if (iChars.indexOf(document.getElementById('P3_CLASS_NAME').value.charAt(i)) != -1) {
  	alert ("Please remove Special characters.");
  	return false;
        }
  }
}
This code works great but I have another function that is being called in the same CREATE button. This other function allows the characters entered to save data to table and also display in Item based on button click. I need help extending my JavaScript to possibly disable the Create button if any of the specified characters are entered and also make sure the button is displayed if not.
My other function is based from this example: http://apex.oracle.com/pls/otn/f?p=48254:2:4259715185364467::NO::P2_EMPNO:7369 that works great also. Click 'New City' which displays the functionality that I have. But I need to also be able to alert an end-user that special characters are not allowed and also not allow them to select the CREATE button and save that data anyway.
I hope this is clear and I also have a example on apex.oracle.com if needed, thanks for reviewing.

Edited by: Charles A on Feb 25, 2010 12:39 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 31 2010
Added on Feb 25 2010
1 comment
1,110 views