Help needed with HTML

8 posts Page 1 of 1
Contributors
User avatar
smashapps
Coding Guru
Coding Guru
Posts: 961
Joined: Tue Apr 05, 2011 8:41 am

Help needed with HTML
smashapps
Hi everyone,

I don't normally request for help in this section...

Anyway I am using HTML and JavaScript (Bootstrap) and I have a toggle button that can be toggled, either selected or not selected:
Code: Select all
<a href="#" class="btn btn-danger" data-toggle="button">Not Owned</a>
It's in a table that will be part of a form, how would I get the value of it being toggled?

It's going to be connected to a database that stores which Skylander figurines you own.

Image

Any help would be appreciated, thanks everyone.
My name is Tom | Visit my blog where I post new content every day! Tom's Daily Blog | MineCraft is awesome!
User avatar
visualtech
VIP - Donator
VIP - Donator
Posts: 265
Joined: Sat Nov 19, 2011 2:19 pm

Re: Help needed with HTML
visualtech
Hey #smashapps,

I had a look at your screenshot and it seems that you're just using chrome for testing. Use XAMPP (or some flavour of Apache) as there is a bug with JS library (jQuery) that they don't resolve properly.

Hmm... You need to import the js files in this order:
Code: Select all
<script src="js/jquery.js"></script>
<- -- Bootstrap --->
<!-- Your JS -->
How exactly do you want it to be toggled? Like JS Via AJAX or a static PHP page?
Image
User avatar
smashapps
Coding Guru
Coding Guru
Posts: 961
Joined: Tue Apr 05, 2011 8:41 am

Re: Help needed with HTML
smashapps
Hey,

1. I'm on a phone so my writing may come out terrible.

I would like to use PHP.

I do have xampp, that photo was just an example. I need a way to select each skylander then hit save to update the user's account.

Can I use Ajax to avoid the need of reloading the page and update the database without needing to reload the page? What's my best option here?

Thanks.
My name is Tom | Visit my blog where I post new content every day! Tom's Daily Blog | MineCraft is awesome!
User avatar
zachman61
VIP - Donator
VIP - Donator
Posts: 1891
Joined: Wed Dec 16, 2009 9:56 pm

Re: Help needed with HTML
zachman61
What do you want the button to do? Do you want it to only show if they don't have it owned?
Nailing my feet to the floor is easier than using my own muscles to balance, but you don't see me doing that :)
User avatar
smashapps
Coding Guru
Coding Guru
Posts: 961
Joined: Tue Apr 05, 2011 8:41 am

Re: Help needed with HTML
smashapps
I need to either 'check' it like a checkbox or update the database saying they own it.

I could solve this with a checkbox but it doesn't look as good.
My name is Tom | Visit my blog where I post new content every day! Tom's Daily Blog | MineCraft is awesome!
User avatar
benji_19994
VIP - Donator
VIP - Donator
Posts: 156
Joined: Mon Apr 16, 2012 3:13 pm

Re: Help needed with HTML
benji_19994
You'll probabbly have to write a ajax or java script function to do that i believe or could you modifie the way a check box looks in css
User avatar
benji_19994
VIP - Donator
VIP - Donator
Posts: 156
Joined: Mon Apr 16, 2012 3:13 pm

Re: Help needed with HTML
benji_19994
Hmm make the buttons store a value of Null or one 1 in JSON via javascript then make it post to the database
User avatar
visualtech
VIP - Donator
VIP - Donator
Posts: 265
Joined: Sat Nov 19, 2011 2:19 pm

Re: Help needed with HTML
visualtech
Sorry for the late reply, this is what you can do.
Code: Select all
var toAdd = getFromAjax();
$("#id1").addClass((toAdd === "true") ? "disabled" : "");

// to make sure it doesn't respond to clicks.

$("#id1").click(function() {
  if $(this).hasClass('disabled')
    return;
});
Image
8 posts Page 1 of 1
Return to “Help & Support”