File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Problem in using javascript in cgi-perl Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Problem in using javascript in cgi-perl " Watch "Problem in using javascript in cgi-perl " New topic
Author

Problem in using javascript in cgi-perl

monika chaturvedi
Greenhorn

Joined: Jan 01, 2009
Posts: 5
hello ,i am using javascript in cgi-perl for popup alert and now in pop alert i am doing number checking for user input using regular expression ,
i am try to do this thing by two ways but still is not working .please help me out.
function numcheck()
{
var myForm = document.add_quiz;
var message = '';
var num=/^[0-9]+$/;

if(myForm.marks.value.match(myForm.marks.value.num)) or if(myForm.marks.value != myForm.marks.value.num)
{
alert('Please enter digit');
return(false);
}
else
{
return(true);
}
}
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61761
    
  67

Please take the time to choose the correct forum for your posts. This forum is for questions on advanced Java.

For more information, please read this.

This post has been moved to a more appropriate forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
monika chaturvedi
Greenhorn

Joined: Jan 01, 2009
Posts: 5
actually i am running this script in internet browser where we genreally dont get error message .as i told you before that i using javascript in cgi-perl .so when i am using javascript for noraml validation like empty text box and retype password is wrong for that javascript is executing perfectly but when i am adding code for this number checking using regular expression in javascript as a third function then my whole code for javascript is not executing and the code which i am using for number checking i already send you.
looking forward for your respone!!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42913
    
  68
actually i am running this script in internet browser where we genreally dont get error message

"Internet browser" is a generic term, so that doesn't really help. All browsers generate error messages if there are JavaScript problems. In Firefox you can view those in the Tools -> Error Console window. In Internet Explorer these need to be turned on somewhere in the Internet Options; if you don't know how to do that you can use Firefox instead.

as i told you before that i using javascript in cgi-perl

CGI/Perl is a technique for creating HTML/JavaScript on the server. It has no bearing on what happens in the browser.

I'm having a little trouble understanding the remainder of the post; please use punctuation to separate sentences.
monika chaturvedi
Greenhorn

Joined: Jan 01, 2009
Posts: 5
actually there is no need of error message because my script is working fine but where i put alert message it should give the alert for non numeric input but i am not getting that pop of alert .i just want that it should give me popup with alert when non numberic input is entered and when i m entering non numeric input its going to next page didnt checked my validation and not printing my alert which i want.

I hope ,now i make you understand what i exactly want.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42913
    
  68
actually there is no need of error message because my script is working fine but where i put alert message it should give the alert for non numeric input but i am not getting that pop of alert .

So I guess it is not working fine

if(myForm.marks.value.match(myForm.marks.value.num))

if(myForm.marks.value != myForm.marks.value.num)

Both these look suspect. If "myForm.marks.value" is the value of a form field -and thus a String-, what is "myForm.marks.value.num" supposed to be? Strings do not have a "num" attribute.
monika chaturvedi
Greenhorn

Joined: Jan 01, 2009
Posts: 5
sorry ,actually that is
if(myForm.marks.value.match(myForm.num.value))
then do this
.............

i did like this in my actual program
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42913
    
  68
I'd put in alert statements that show you the actual values of the fields you're comparing. Using a JavaScript debugger may also be helpful.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in using javascript in cgi-perl