frank_solo Posted May 14, 2013 Share Posted May 14, 2013 I have a few fields in which I just want the user to input numbers. I thought I wrote the srcipt correctly but it seems not be working. Can anyone please tell me what I am doing wrong. I very new to this. Thanks <script Language="JavaScript"> <!-- function Number_Validator() { var valid = true; if(isNaN(refine_table.min_sq.value)) { alert("Only numbers are allowed in the Square Footage fields."); refine_table.min_sq.focus(); return (false); } if (!valid) alert(msg); if(isNaN(refine_table.max_sq.value)) { alert("Only numbers are allowed in the Square Footage fields."); refine_table.max_sq.focus(); return (false); } if (!valid) alert(msg); if(isNaN(refine_table.min_price.value)) { alert("Only numbers are allowed in the Amount fields."); refine_table.min_price.focus(); return (false); } if (!valid) alert(msg); if(isNaN(refine_table.max_price.value)) { alert("Only numbers are allowed in the Amount fields."); refine_table.max_price.focus(); return (false); } if (!valid) alert(msg); return valid; } --> </script> Quote Link to comment https://forums.phpfreaks.com/topic/277997-number-fields-only-isnan-function/ Share on other sites More sharing options...
Psycho Posted May 14, 2013 Share Posted May 14, 2013 It is not working how? Are you getting errors or what? Quote Link to comment https://forums.phpfreaks.com/topic/277997-number-fields-only-isnan-function/#findComment-1430060 Share on other sites More sharing options...
frank_solo Posted May 14, 2013 Author Share Posted May 14, 2013 No errors just dosen't do what it is suppose to do. Quote Link to comment https://forums.phpfreaks.com/topic/277997-number-fields-only-isnan-function/#findComment-1430062 Share on other sites More sharing options...
Solution frank_solo Posted May 14, 2013 Author Solution Share Posted May 14, 2013 Nevermind the fields were named differenttly. DOH! Quote Link to comment https://forums.phpfreaks.com/topic/277997-number-fields-only-isnan-function/#findComment-1430063 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.