|
Working with forms
I am working with javascript forms for an assignment. The goal is to be able to prompt for a input, check it, and then write it to the page or display it in a new pop-up window. So far I have the javascript correctly checking my data, but I can't figure out how to make it echo the results back.
In the script I have a few testing functions to make sure the input is the correct form. They look something like...
function isEmpty(elem) { } --checks to see if field empty
function isValid(elem) {} --checks to see if field correct
function validate(form){} --returns true if (isEmpty && isValid)
In the body i have some code, listed below, that handles my input.
<input type="text" size="30" name="name1" id="name1" onchange="if (isEmpty(this)) {isValid(this)}" /><br />
<input type="submit" />
I'm mostly just looking for a little guidance on how to declare an output function and where/how to call it.
The simple examples I have looked up all seem to deal with input that isn't verified, and I can't quite figure out how to make that example work with what I am doing.
|