|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
hi pals
I need a command to come out of the javascript some thing like exit(); even i tried exit(); System.exit() and break() its was not working Pls revert me asap sarath |
|
#2
|
||||
|
||||
|
Can you be a little more specific, maybe post some code? Perhaps "return true" will do what you want.
__________________
Please don't PM me asking for solutions outside the scope of a thread. Keeping all responses in a thread stands to help others who come along later, which is after all what this forum's all about. |
|
#3
|
|||
|
|||
|
hi
here is some piece of code function sample(v1,v2) { if (v1.value >= v2.value) { alert("The Succeding value Should be GREATER than the Previous value"); v2.focus(); v2.select(); exit(); //-- here the error comes } } i'm having 10 text boxes and the the value of preceeding text box is greater than the previous one. while submiting i'm calling the function like this sample(textbox1.value,textbox2.value); sample(textbox2.value,textbox3.value); sample(textbox3.value,textbox4.value); and so on .... Sarath |
|
#4
|
||||
|
||||
|
You don't need to exit. You only need to exit if there's code that you want to prevent from executing under certain conditions. In this case, you have no such code and the function will exit once it's finished executing. Just remove your exit() line.
Also, please don't double-post. I've deleted your other post. |
|
#5
|
||||
|
||||
|
Incidentally, there's another problem with your code. You're passing it the field values but are then calling the focus() method on the value rather than on the field. You're also trying to use v1.value, which isn't valid, since you're actually passing v1.value. In your calls to sample(), pass the fields rather than their values (so sample(textbox1, textbox2) rather than sample(textbox1.value, textbox2.value)).
|
|
#6
|
|||
|
|||
|
I think u want this: "if user entered data in 10 text boxes and click the submit button, then data in text boxes should be varified. And if all data is right then form should be submit, other wise not."
Put this script in your body tag <script> function ProcessForm() { function sample(v1,v2) { if (v1.value >= v2.value) { alert("The Succeding value Should be GREATER than the Previous value"); v2.focus(); v2.select(); return false; } else return true; } // in the code below myform is your form name. if( !sample(document.myform.textbox1 , document.myform.textbox2) ) return false; if( !sample(document.myform.textbox2 , document.myform.textbox3) ) return false; if( !sample(document.myform.textbox4 , document.myform.textbox5) ) return false; .................................................. .......................... .................................................. ........................... } </script> and in your submit button do this: <input type="submit" value="Submit" onclick="return ProcessForm()"> .................................. Burhan |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Command to come out of the javascript |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|