Re: disable submit button
From: Martin Honnen (Martin.Honnen_at_t-online.de)
Date: 03/10/04
- Next message: Dave Anderson: "Re: Problem with multiple select size=1"
- Previous message: Martin Honnen: "Re: How can i access script variables of an iframe"
- In reply to: BoB Bedford: "disable submit button"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 10 Mar 2004 14:02:12 +0100
BoB Bedford wrote:
> On the same page, I can have 2 or 3 submit buttons (depends if the user is
> registered or not):
>
> not registered:
> Search Cancel
>
> registered
> Search Save Cancel
>
> Now, on a textbox, I've added a onKeyUp event
> (onKeyUp="javascript:testRecord();")
>
> My code for now:
> function testRecord(){
> if (document.FormSubmit.SearchAnnounce.value == ''){
> document.FormSubmit.SubmitButton[1].disabled = false;
> }
> else
> {
> document.FormSubmit.SubmitButton[1].disabled = true;
> }
> }
>
> This works fine when the user is registered (when they are 3 buttons) but
> not when they are only 2 buttons.
> I can't change the name of the buttons. So it's there any way to do it on a
> specific button if it' present only ?
> something like: document.FormSubmit.SubmitButton['Save'].disabled = true;
document.forms.FormSubmit.elements.Save.disabled = ...
if you have
<input type="submit" name="Save" ...>
-- Martin Honnen http://JavaScript.FAQTs.com/
- Next message: Dave Anderson: "Re: Problem with multiple select size=1"
- Previous message: Martin Honnen: "Re: How can i access script variables of an iframe"
- In reply to: BoB Bedford: "disable submit button"
- Messages sorted by: [ date ] [ thread ]