riddhi Posted May 3, 2007 Share Posted May 3, 2007 here is my java code that I am using:- function checkShippingAndPaymentInfo() { with (window.document.frmCheckout) { if (isEmpty(txtShippingFirstName, 'Enter first name')) { return false; } else if (isEmpty(txtShippingLastName, 'Enter last name')) { return false; } else if (isEmpty(txtShippingAddress1, 'Enter shipping address')) { return false; } else if (isEmpty(txtShippingPhone, 'Enter phone number')) { return false; } else if (isEmpty(txtShippingState, 'Enter shipping address state')) { return false; } else if (isEmpty(txtShippingCity, 'Enter shipping address city')) { return false; } else if (isEmpty(txtShippingPostalCode, 'Enter the shipping address postal/zip code')) { return false; } else if (isEmpty(txtPaymentFirstName, 'Enter first name')) { return false; } else if (isEmpty(txtPaymentLastName, 'Enter last name')) { return false; } else if (isEmpty(txtPaymentAddress1, 'Enter Payment address')) { return false; } else if (isEmpty(txtPaymentPhone, 'Enter phone number')) { return false; } else if (isEmpty(txtPaymentState, 'Enter Payment address state')) { return false; } else if (isEmpty(txtPaymentCity, 'Enter Payment address city')) { return false; } else if (isEmpty(txtPaymentPostalCode, 'Enter the Payment address postal/zip code')) { return false; } else { return true; } } I want that the invalid entry to be displayed as soon as the user enters an invalid input like :- If the user enters name beginning with 1 for example a window will pop up informing invalid input. How to do it? Link to comment https://forums.phpfreaks.com/topic/49784-javascript-help/ Share on other sites More sharing options...
joshi_v Posted May 3, 2007 Share Posted May 3, 2007 I guess u can use OnKeyPress . write a function to check the character codes and call it on OnkeyPress event. i think it works for u. All the best. Link to comment https://forums.phpfreaks.com/topic/49784-javascript-help/#findComment-244228 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.