how can chak
-
how can chak the input field is not empty when click on submit button
sanjeev
-
how can chak the input field is not empty when click on submit button
sanjeev
Hi, If you are using ASP.Net then the RequiredFieldValidator control will provide you with a means to validate the input field on postback, and this will handle both client and server-side validation. If you are not using .Net then I suggest you perform validation on the client-side using JavaScript, by attaching a validation function to the submit button's onclick event e.g.:
<input type='button' value='Submit' onclick='return checkEntry();'> function checkEntry() { if (document.getElementById('textBox').value.length == 0) return false; return true; }
And also server-side by validationg the contents of the textbox.Clean code is the key to happiness.
-
Hi, If you are using ASP.Net then the RequiredFieldValidator control will provide you with a means to validate the input field on postback, and this will handle both client and server-side validation. If you are not using .Net then I suggest you perform validation on the client-side using JavaScript, by attaching a validation function to the submit button's onclick event e.g.:
<input type='button' value='Submit' onclick='return checkEntry();'> function checkEntry() { if (document.getElementById('textBox').value.length == 0) return false; return true; }
And also server-side by validationg the contents of the textbox.Clean code is the key to happiness.
Hi its work but after getting value also it return false
sanjeev
modified on Thursday, January 31, 2008 4:29:38 AM
-
Hi, If you are using ASP.Net then the RequiredFieldValidator control will provide you with a means to validate the input field on postback, and this will handle both client and server-side validation. If you are not using .Net then I suggest you perform validation on the client-side using JavaScript, by attaching a validation function to the submit button's onclick event e.g.:
<input type='button' value='Submit' onclick='return checkEntry();'> function checkEntry() { if (document.getElementById('textBox').value.length == 0) return false; return true; }
And also server-side by validationg the contents of the textbox.Clean code is the key to happiness.
Hi, If you took my code as was then you would need to change the type of the input control to submit, rather than button, as that will then cause a postback e.g.
<input type='submit' value='Submit' onclick='return checkEntry();' />
Clean code is the key to happiness.
-
Hi, If you took my code as was then you would need to change the type of the input control to submit, rather than button, as that will then cause a postback e.g.
<input type='submit' value='Submit' onclick='return checkEntry();' />
Clean code is the key to happiness.
thanks it work fine but one thing i wants to add in it if length is 0 then alert massage also thanks again
sanjeev
-
thanks it work fine but one thing i wants to add in it if length is 0 then alert massage also thanks again
sanjeev
-
Hi, Simply add an alert message after checking the value length:
function checkEntry() { if (document.getElementById('textBox').value.length == 0) { alert('Value is required'); return false; } return true; }
Clean code is the key to happiness.
thanks Now woking fine Regrads
sanjeev