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> 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? 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. Link to comment https://forums.phpfreaks.com/topic/277997-number-fields-only-isnan-function/#findComment-1430062 Share on other sites More sharing options...
frank_solo Posted May 14, 2013 Author Share Posted May 14, 2013 Nevermind the fields were named differenttly. DOH! 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
Archived
This topic is now archived and is closed to further replies.