Input Type = "Image"

Giganews Newsgroups
Subject: Input Type = "Image"
Posted by:  Jawahar Rajan (jraj…@nc.rr.com)
Date: Tue, 22 Jul 2003

All,
I am using a few Input type of "Image" instead of a classic submit button in
a form to achieve various tasks

for example
image1 - add user
image2 - modify user
image3 - delete user
image4 - reSet user.

These are only image and I use the onClick event to run JavaScript function
called whichPage

Function whichPage(nextPage)
{
    if (nextPage = = 'addUser')
        document.frmAdmin.action="AdminNewUser.asp"
    if (nextPage = = 'modUser')
        document.frmAdmin.action="AdminModUser.asp"
    if (nextPage = = 'delUser')
        document.frmAdmin.action="AdminDelUser.asp"
    if (nextPage = = 'resetUser')
        document.frmAdmin.action="AdminResetUser.asp"

}

in the main form there is a list of users with a radio button to each user.
What I want to do is to check that at least one radio button is selected
when the image2, image3 or image4 is clicked.
I have tried to use onClick="return whichPage()"
But I do not think that returning "false" to the onClick event works because
of the document.frmAdmin.action="...." will re-route the page before it can
return.
So my queation is how can I check that At least one radio button is checked
when one of the three images in question are clicked.
The form on Submit is no good because it will also check it when Image1 is
clicked and I do not want; as this adds a new user and hence an existing one
does not need to be selected.

Any suggestions or ideas will be appreciated

Thanks
Jawahar

Replies