darkcarnival Posted January 19, 2007 Share Posted January 19, 2007 hi,I wish to use either ajax or js or both to validate my php script.now i am new to js & ajax so im curious if anyone can direct me to a good tutorial or some tips on this.what I'm looking for?-when an error occurs a message appears next to the form boxmight want this to be ajax-based so that it can check this before anything processes.i know ipb does something similar, so if someone knows how they do it, that'd help even more.thank you in advance. Quote Link to comment https://forums.phpfreaks.com/topic/34920-form-validating-help/ Share on other sites More sharing options...
bibby Posted January 22, 2007 Share Posted January 22, 2007 Use javascript to valiate basic things,like wether en email address is really an email address,or if the number you products you want to order is an actual interger.Use ajax to validate specific things,like if your particular email address is in a database.[code]<script>function validate(){ var e = document.getElementById('thing').value; if (e == '') {alert('dude, its blank');} else if (isNaN(e)) {alert('dude, thats not a number');} else {alert('ok, looks good.')}}<input type="text" id="thing" name="thing"><input type="button" onclick="validate();" value="check"></script>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/34920-form-validating-help/#findComment-165968 Share on other sites More sharing options...
darkcarnival Posted January 24, 2007 Author Share Posted January 24, 2007 ajax would be better :)thank you for the code example. Quote Link to comment https://forums.phpfreaks.com/topic/34920-form-validating-help/#findComment-167776 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.