/    Sign up×
Community /Pin to ProfileBookmark

Trying to hide a button upon clicking on it

Hi All,
I’m trying to hide a button once someone clicks on it so they can’t keep clicking on it. Below is my code. At the beginning of the code I’m checking for form validations in the else is where I’m trying to make my button hidden.

<script language=”JavaScript”>
function checkAdminFields(){
missinginfo = “”;
if (document.form.field90.value == “”){
missinginfo += “n – Processed By”;
}
if (document.form.field91.value == “”){
missinginfo += “n – Issue Date”;
}
if (document.form.field92.value == “”){
missinginfo += “n – Fee Amount”;
}
if (document.form.field93.value == “”){
missinginfo += “n – Permit No.”;
}
if (missinginfo != “”) {
missinginfo =”_____________________________________n” +
“You failed to correctly fill in your:n” +
missinginfo + “n_
__
__________________________________” +
“nPlease enter the missing data and submit again!”;
alert(missinginfo);
return false;
}

else {

document.form.approve.style.visibility = ‘invisible’;
return true;

}

}

</script>

Every time I hit the Approve button I keep getting a javascript error of: “Could not get the invisibility property. Invalid argument.”

Does anyone know why I keep getting this?

Here’s my code on my page where I’m calling my function:
<input type=”submit” value=”Approve” name=”approve” onclick=”return checkAdminFields();”>

Thanks in advance for your help.
Kelly

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@HaganeNoKokoroSep 15.2004 — Well, the style for invisibility is 'hidden' not 'invisible'

You could also try
<i>
</i>document.form.approve.disabled="true";

to disable the button instead of hiding it.
Copy linkTweet thisAlerts:
@kferriauthorSep 15.2004 — Thank you so much HaganeNoKokoro I figured it was something stupid I was doing. Works Great!! Thanks Again!
×

Success!

Help @kferri spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...