/    Sign up×
Community /Pin to ProfileBookmark

Error message as a trigger to hide the continue buttons

There is a hard coded error message that pop us when specific criteria is met, what I want to do using JavaScript is once this error message is triggered and pops up on the screen I want to hide the conitue buttons so people can not proceed to the next page. I basically need to use the error message as a trigger to hide the continue buttons.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@ZeroKilledMay 08.2008 — i guess you wrote the code to trigger such error when the criteria isn't met. i.e., is a validator or something alike. the first thing that come to my mind is to disable the button. if the button is an input element, then you can set the property [B]disabled[/B] to true:
<i>
</i>// on your error message, assuming the button have an id
document.getElementById('the_button_element').disabled = true;


then you have to set the property to false when the condition are met. that is, at the end of the validator, if no error message is triggered, you would do [I]button.[/I]disabled = false;

however, if the button is other element than an input, you can do one of two thing: remove the registered event until condition are met, or hide the element. to not make it more complicated, i guess hidding the element is sufficient. the approach is like the previous one but instead of setting the [B]disabled[/B] property you would use css property as [B]display[/B] or [B]visibility[/B]

<i>
</i>// on your error message, assuming the button have an id
document.getElementById('the_button_id').style.visibility = 'hidden';


and again, you have to set back the value if condition are met. to set it back, just pass an empty string to the [B]visibility[/B] property.
Copy linkTweet thisAlerts:
@syphen6authorMay 08.2008 — I need a way to trigger the hide buttons JS without changing the hard code.
×

Success!

Help @syphen6 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.18,
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,
)...