Page 1 of 1

Checkbox required

Posted: Mon Jun 17, 2013 5:50 pm
by matthijs110
hi,

There is a website http://blizzardcraft.com/donations/.

There is a butten and a checkbox.

When i click on the Button (donate) without checking the checkbox, i get a pop-up screen.
when i click on the Button (donate) and have clicked on the checkbox, i will be redirected.

i found this line in the source code of the Donate button:
<input name="notify_url" value="http://blizzardcraft.com/donation_callback.php" type="hidden">
How can i make this either. I am not very good in php.

(I dont ask if someone can make it for me)

Matt

Re: Checkbox required

Posted: Mon Jun 17, 2013 7:41 pm
by ExtremeGaming
This would be done with JavaScript, not PHP. However, you will need to validate it server side either way due to users that might have JavaScript disabled.

You can try this with JavaScript. Of course, you're going to need to incorporate it into your code so that the submission returns false if not checked.
if(document.getElementsByName("notify_url") === false) {
  alert("Not checked");
} else {
  // Checked
}

Re: Checkbox required

Posted: Tue Jun 18, 2013 4:57 am
by matthijs110
So where do i put it?

Re: Checkbox required

Posted: Sat Jun 22, 2013 9:03 pm
by FrederickGeek8
You would put either in the <head> wrapped in <script> tags or below all of your website contents (right before </body>)

Re: Checkbox required

Posted: Sun Jun 23, 2013 5:28 am
by matthijs110
And then i get an popup when my checkbox is not checked? And my donate button isn't clickable without having the checkbox checked?

Re: Checkbox required

Posted: Sun Jun 23, 2013 12:29 pm
by Temor
matthijs110 wrote:And then i get an popup when my checkbox is not checked? And my donate button isn't clickable without having the checkbox checked?
ExtremeGaming wrote:Of course, you're going to need to incorporate it into your code so that the submission returns false if not checked.
You can't just blatantly copy & paste and expect it to work...

Re: Checkbox required

Posted: Sun Jun 23, 2013 2:14 pm
by matthijs110
I can still click on the button without having the checkbox checked.

Re: Checkbox required

Posted: Sun Jun 23, 2013 5:06 pm
by Temor
Please read my previous post again.

Re: Checkbox required

Posted: Sun Jun 23, 2013 5:12 pm
by matthijs110
Srry, but i just cant follow it :(

Re: Checkbox required

Posted: Sun Jun 23, 2013 5:29 pm
by Temor
That's because you're expecting to just copy & paste for it to work without doing any work yourself.

Ask for help on how to fix this and you'll get help.
Ask to get this done for you and you will be ignored.

Try yourself before asking and it will be much more satisfying to you when it finally does work.

Re: Checkbox required

Posted: Sun Jun 23, 2013 5:57 pm
by matthijs110
I tryed everything.

It just wont work :(