| | |
can't validate columns created using createElement
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
another problem 
well i am calling these functions on the "onblur event"
now i also want that when the user clicks on submit..
all the functions are called....
so i was writing something like:
doesn't work

well i am calling these functions on the "onblur event"
now i also want that when the user clicks on submit..
all the functions are called....
so i was writing something like:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
iteration = document.getElementById("no_of_applications").value for ( i=1;i<iteration;i++) { error_appname('application_name'+i,erSpan1) }
doesn't work
rEaLITy iS aN iLLUSIOn cAUSED bY lACk oF aLCOHOL....
This can be done in many ways, but I will tell you easiest way:
Your function error_appname(inputField, erSpan), requires 2 argument, so maintain global arrays for those.
Now the function to validate all fields will be:
Your function error_appname(inputField, erSpan), requires 2 argument, so maintain global arrays for those.
javascript Syntax (Toggle Plain Text)
// Global arrays used to hold input fileds and error spans var inputFieldArray = []; var erSpanArray = []; function addRow() { // Some of your code gl.type = 'text'; gl.name = 'application_doj' + iteration; gl.id = 'application_doj' + iteration; gl.size = 45; gl.className='cellData'; gl.style.width='220px' gl.style.height='17px' gl.value='mm/dd/yyyy' // Removed your handlers from here and putted it below cellLeft.appendChild(gl); document.getElementById("no_of_applications").value=iteration //Adding span for showing validation error var erSpan = document.createElement('span'); // Add error span to this cell. cellLeft.appendChild(erSpan); // Here goes ur handler gl.onfocus= function() {gl.value=""}; gl.onblur= function() {ValidateForm(erSpan)}; // Passing erSpan, so that we can easily show error message // Push elements in global arrays inputFieldArray.push(gl); erSpanArray.push(erSpan); }
Now the function to validate all fields will be:
javascript Syntax (Toggle Plain Text)
function validateAll() { var totalRows = inputFieldArray.length; // OR erSpanArray.length for(var i = 0; i < totalRows; i++) { error_appname(inputFieldArray[i], erSpanArray[i]); } }
When you think you have done a lot, then be ready for YOUR downfall.
This may work for you:
javascript Syntax (Toggle Plain Text)
var dgebi = document.getElementById; // This function takes elements not elements id. error_appname(dgebi ('application_name'+i), dgebi ('erSpan' + i));
When you think you have done a lot, then be ready for YOUR downfall.
![]() |
Similar Threads
- Hyperlink in gridview (columns are created dynamically) (ASP.NET)
- validate xml using xsd (XML, XSLT and XPATH)
- CheckedListBox MultiColumn (C++)
- XML Management (RSS, Web Services and SOAP)
- General rules when working with divs and css. (HTML and CSS)
- AJAX generated <select> and FIREFOX (JavaScript / DHTML / AJAX)
- phpBB bots creating fake users! (Social Media and Online Communities)
- Need help: How to covert a program to an applet? (Java)
- records should be in tamil letters (a language in india) and english when displyed (MS Access and FileMaker Pro)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: JavaScript onmouseover image gallery
- Next Thread: How to extract HMTL content through the use of XMLHttpRequest object?
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
ajax ajaxcode ajaxhelp animate api automatically beta boarder box bug calendar captchaformproblem card checkbox child class column cookies createrange() css cursor disablefirebug dom download dropdown editor element engine error events explorer ext file firehose flash form forms game google gwt html htmlform ie8 iframe image() images internet java javascript jawascriptruntimeerror jquery jsf jsfile jump math matrixcaptcha microsoft mimic mp3 mysql object offline onmouseoutdivproblem onreadystatechange parent passing pdf php player post problem progressbar rated rating regex runtime scroll search select session shopping size sql star stars stretch text textarea twitter validation w3c web website window windowofwords windowsxp wysiwyg xml xspf \n





