Posted by Malte on 12/17/05 11:45
number1.email@gmail.com wrote:
> Hello,
>
> I have a simple Web Page Questionairre in which questions are read from
> a database, and the user can indicate the correct answer via either a
> radio input control or a dropdown list.
>
> The number of questions that is displayed on the screen can
> vary...depending on the number of questions that satisfy certain
> criteria.
>
> Does anyone have any sample code, or can show me how I can validate
> this Web Page in JavaScript so that the user is forced to "answer"
> every question on the form (whether it is a radio control or dropdown
> list).
>
> Thanks.
>
I am currently writing pages that require approx. 600 lines of
javascript in addition to the 3-400 lines of struts/html.
To do what you want you will have to have your submit call a validate()
js function which implements the userside logic you want. Obviously, you
will have to implement serverside checking as well, or risk db
inconsistency.
Any js primer will tell you how to get/set element values and how to use
the sick (My Opinion) language.
[Back to original message]
|