I'll be back to normal soon!nnOh and another $450 month last month :D

Yep, still busy here, but getting through it all slowly. In the mean time any WordPress users out there may be interested in my latest posts for BloggingTips.com. I decided that I wanted to see how the new Gallery feature worked in WordPress, along with displaying the EXIF data of the photo(s) uploaded, in part because it's useful to know, and also because I'm setting up my own gallery of favourite shots with a bit more info on each. A bit of a photoblog but not just the typical 1 photo a day, more a selection of galleries and posts mainly on photography and various events with good photo opportunities.

Anyway, since version WordPress 2.5 was released, a gallery feature has been available, but the WordPress Codex doesn't really go into detail about how to use it, so after a fair bit of research and playing, I've created my own how to posts on using it. I hope it's perhaps of use or interest to others too.

Usually you blog about something, putting your opinion over about something. Well today it's my turn to ask the questions! I have a number of jQuery questions and figured I'd leave them up here for either me to then find the answer or for someone who may know the answer to give me a few hints ;)

This isn't a 'how do I do this'. What I have already works, but I'm sure it could work a lot more efficiently and a couple of questions linger in my mind as to how or even whether it's possible.

Update: I've got the first issue working thanks to Marc Grabanski (who has an excellent site and is a must read for any jQuery user!)

1. I need to create a function that resets several select lists. However the id of each select list is dynamically generated. What I have is a select list with a list of parents in and each has an ID. Then each parent has a child select list, and the child select list uses the parent ID to make it unique (with me so far?!). At present I use PHP to generate the function by looping through the parent IDs (retrieved from a database), which gives me:

JavaScript function
  1. function resetLists() {
  2. $('#child1')[0].selectedIndex = 0;
  3. $('#child2')[0].selectedIndex = 0;
  4. $('#child3')[0].selectedIndex = 0;
  5. }

However, I'm sure there must be a way that I can just use jQuery to read through all of the option values of the parent list and get the 1, 2 and 3 from that and do the same above i.e have a function that pretty much says 'get each value from the parent list and for each value set the selectedIndex to 0 for the child + value list. I'm sure it's possible, but how, I don't know (yet).

2. This is one I've not actually got working yet. I'm working on an admin area and I've got the parents listed in a table. Then at the end is the option to remove the parent. However as each parent has one or more children, the children need to be moved to another parent. So when you click 'Remove' it gives a select list of the available parents to move the children to. You can select the new parent and then click Go. However at this point I don't want the form to actually submit and reload the page (which it's currently doing), I want the form to trigger a function which runs the PHP file to move the children, delete the parent and just remove the table row of the parent off the screen.

So far I've got it to run the function, however once the function runs the page refreshes. The only way I've got this function to run is by using the onsubmit attribute in the form tag. Now I know I could change the submit button to a standard button, but surely there's a way to prevent the form form submitting? I've tried putting return false; at the end of the function that's run, but that doesn't seem to work. I've tried putting the function in the action with javascript: at the start of it, but that really didn't work!

Update: Some code may help. This is what I have at present.

Remove Function
  1. function exremtrade(id) {
  2. var newtrade = $('#trade_' + id).val();
  3. $.get("/admin/includes/remTrade.inc.php", {id: id, nt: newtrade}, function(data) {
  4. if (data) {
  5. $('#message').text('Trade details removed.').fadeIn();
  6. $('#row' + id).fadeOut();
  7. } else {
  8. $('#message').text('Error removing Trade details.').fadeIn();
  9. }
  10. });
  11. return false;
  12. }

I've then got a form that has the attribute onsubmit which runs

onsubmit="exremtrade(2)"

Where '2' is the ID of the trade to remove. The new trade ID is in the select list, also in the form. Now if I remove the form and just use a button and the select list, it works. But of course that isn't valid, and ideally the form should be there just in case the user doesn't have JavaScript (plus I'd like to understand why it's not working!). However, with the form in place, and the button as either a button or submit input, the function runs, works as it should, but then the form gets submitted which effectively refreshes the page and loses my update message.

That's my two questions so far. I'm currently reading jQuery in Action thanks to Si's recommendation, which is a great book, I'm just a slow reader! 2 months ago I didn't have a first clue about AJAX, and now I'm quite confident with the basics. My first AJAX enabled site has been live for almost a week and it's not collapsed! I'd just love to be able to improve it further :)

Yes, it's been a couple of weeks. I'm still alive… just. The site (that 2 week site) finally went live on Friday after 8 weeks of work, and it's not finished yet! It was rushed for going live as TV adverts for the site were already in place. Despite this I still wasn't left to actually finish what was already decided on, and further amendments kept coming right up to 2 hours before the first advert went out! Will clients never learn? I've got 2 major sites on the go, one I'm working on mainly, the other I'm mainly co-ordinating and doing minor work on. Both need to be completed ASAP.

However, my back is still in pain. I finally saw a doctor today who pretty much ruled out Kidney problems (which I'd already guessed) and just put it down to a muscular strain. Personally I think it's a trapped nerve as the stabbing pains come on instantly and can go just as quick. Some days it doesn't come on, others it can be there constantly. I've not been able to do much at all for fear of making the pain worse.

We decided to venture out on Sunday, over to Liverpool to see the Tall Ships that had come in on Friday. I'd hoped to go over on Friday and see them arriving, but that 2 week project had over run a little(!!). Sunday was a glorious day weather wise. We got there around 3pm and the place was just swarming with people. After a short walk in the area of Albert Dock we headed over to Wellington Dock, where most of the ships were along with various stalls and food/drink stalls. It was a nice couple of hours wandering around looking at the ships. After this we went back to the centre of Liverpool and after a quick drink break we took a walk around the new shopping area called Liverpool One. Certainly somewhere I need to go with my Mum and an empty credit card! However, after all the walking around my back certainly felt it yesterday. But I'm glad we went and it's certainly an event I'd recommend to anyone (apparently its on every year, but I'd never heard about it before now).

And that's about it. Work, stress and back pain :D It's not all bad though ;) Now this project is coming to a close things should calm down a little now (well for a while, although the projects are piling up whilst I finish what I've already started) and give me a chance to get back things back to normal a bit!

Sunset over Lake Windermere Ooo what a cool date (note my dates are in the UK version of Day/Month/Year, in case that wasn't already obvious!). So we're into the first week of the second half of the year. Where does the time go?! This week hasn't been so great. On Tuesday evening I started to suffer with a pain in the lower right of my back. I've had this before, sometimes a minor twinge, but 2.5 years ago I had a kidney infection which caused just as much, if not more pain. Obviously my main concern is always something like this happening again. On Wednesday I woke up in even more pain and by lunchtime I had to go back to bed as I just couldn't sit in my desk chair. Luckily the tennis was pretty good on TV! Thursday morning the pain didn't seem so bad so I assumed that it was possibly just a strained muscle (yes I guess there's a muscle there somewhere!) and managed to work until early afternoon, but then again I'd pushed it and the pain was worse again. However the pain has lessened each day so I can only assume it is a strain.

Fireworks, Bowness Besides that, I've managed to get through a few more photos and get my photos from our weekend to the Lake District up on Flickr. Whilst we were there they had this WoW Factor event on (WoW – Windermere on Water) which involved some french street artists hoisted up on a crane above the crowds and a fireworks show.

This week I also got my contract renewed with my mobile phone supplier, and got a new phone in the form of the Nokia E65. It's not a new phone (It was out about 15-18 months ago) but the difference between this and my old Nokia N73 is that it has WiFi so I can use it to check email and connect to the web for free when at home or near a free WiFi hotspot. I had wanted to get the N95 but the 'contribution' was going to be £170 which I wasn't prepared to pay. I probably should have argued over it, seeing as new customers get it and a better deal on their minutes etc for free, trouble is I don't need any extra minutes as I don't use the ones I have! Still, the phone does what I need it to do, make calls and check my email. When I was stuck in bed I was also using it to read through a website on jQuery, making my own notes. Obviously I can also go to Google Reader on it, along with other mobile enabled sites.

So not a very eventful week really. I've barely moved much!

Page 11 of 160« First...«910111213»203040...Last »