Jump to content

amavadia

Members
  • Posts

    28
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

amavadia's Achievements

Member

Member (2/5)

0

Reputation

  1. Thank you. I did try that before as well but just realised the silly error i made... used the form name as the selector rather than form id
  2. I have a form on my page with various elements and have created a seperate validate php page. At the bottom of my form I have a button (type="button"). When it is clicked, the data is posted to the validate page, and errors returned. If errors are returned it displays them, if not I want it to post and redirect to another page like a normal form. The problem I have is when I use a type="button" button, the first part works fine but obviously it does not post and redirect because it is not a submit button, but if I change the button type to submit, the .click() handler on the button does not seem to be firing and so the page is posted even without checking for errors. Should i be using a different handler on the submit button as opposed to a button button?
  3. Thanks David, Gave your modifications a go and it didnt work the first time but then I tried putting the second bind inside the last callback and it works perfectly now. Also nested the animations a bit to give it a good sequence. Very nice effect. Heres what I ended up with: $(".del a").bind("click",delClick); function delClick() { var batch = $(this).attr( 'href' ); $("#confirmdel").html('Are you sure you want to delete batch ' + batch + '? <a href="#" id="confirmdelete">Yes</a> <a href="#" id="cancel">Cancel</a>'); $("#confirmdel").show('slow', function(){ $("#confirmdelete").click(function(){ $.post('../scripts/deletebatch.php', {batchid: batch}); $("#confirmdel").hide('fast', function(){ $('#batches').fadeOut('fast', function(){ $('#batches').load('index.php #batches',false,function(){ $('#batches').fadeIn('slow'); $(".del a").bind("click",delClick); }); }); }); return false; }); }); return false; } All the best.
  4. I guess one way would be to start building up a record in the DB when the setexpresscheckout is called and save the amount in there but I was hoping to avoid having to create temp records and only save the information once the transaction was complete?
  5. Hi David, Thanks for the pointers. As you have suggested I changed from an id selector to a class selector so the HTML is now: <td class="del"><a href... and the Jquery is : $(".del a").bind("... The second point you made makes sense but even though new elements are being created, they still have the same names . Anyhow, more than happy to give it a go but im not really sure how to go about binding the new elements after the load? would it just be to copy the same section of jquery code into the callback of the load? The issue there being I would have to embed infinate copies of the code because different users would delete different numbers of items at a time?
  6. Hi all, I am looking to integrate Paypal Express checkout on my site and have been working with the API today. I have got the code working in a static state with predefined payment amounts but I am having trouble making this dynamic. When you first submit a request to set up an express checkout you send the payment amount along with it. The paypal server then makes the checkout and the user is redirected to the paypal site to login and authenticate. From here they click to be redirected back to my site where I have a pay button which when clicked submits the final request to confirm the payment. I am sure there must be a simple solution to this because so many people use paypal already but when you submit the final confirmation request, you have to send the payment amount again, but because the page redirects onto the paypal page inbetween, I can't use a session variable to store the amount. How have other people overcome this? Thanks
  7. Hi So I have a mysql database which contains information on a number of items (we'll call them batches). each user can add multiple batches to the database. On the user's account page, a query looks up all the batches they have submitted and lists them. Today I have been working on a way that the user can delete their batches one at a time from the list without having to refresh the page and I am 90% there, just one little niggle which I cant work out. The way I have done it is where the php loops through the result of the query and lists the batches, it also places an image which looks like this in html: <td id="del"><a href="42"><img src="../images/delete.gif"/></a></td> where 42 is the id for the batch in the db. To pick up when the user clicks the delete image next to a batch I have used the following jquery: <script type="text/javascript"> $(document).ready(function(){ $("#del a").bind("click", function() { var batch = $(this).attr( 'href' ); $("#confirmdel").html('Are you sure you want to delete batch ' + batch + '? <a href="#" id="confirmdelete">Yes</a> <a href="#" id="cancel">Cancel</a>'); $("#confirmdel").show('slow', function(){ $("#confirmdelete").click(function(){ $.post('../scripts/deletebatch.php', {batchid: batch}); $("#confirmdel").hide('slow'); $('#batches').fadeOut('fast'); $('#batches').load('index.php #batches',false,function(){ $('#batches').fadeIn('slow'); }); return false; }); }); return false; }); }); </script> deletebatch.php is just a small php script which takes in the batch id and inactivates it in the db. confirmdel is an empty div on the page which will be used to confirm the delete or cancel it. Now this all works great and once the user confirms the delete, the confirmdel div will fade out, then the list of batches will fade out, the row will be inactivated in the db and the list will fade back in having reloaded and being one item less. But the problem is if the user then clicks on a delete icon next to a batch on the refreshed list, none of the jquery fires and it treats the <a href="42"... as a hyperlink and tries to go to that page. Firstly thought it may have something to do with the fact its within the $(document).ready(function(){} section so I tried to copy the same block of code outside of that but still no luck. Would really appreciate some help with this last bit. Cheers
  8. I am designing a web site which will dynamically generate labels which will be printed out by the end user. I have coded the part which generates each label into an image, but sometimes a user will want to print multiple copies of the same label on a page. I am working on the basis of an A4 page initially and depending on the design of the label, they will be different sizes (but they wont be mixing different designs on a single page so for each a4 sheet, every label will be the same size). I have no idea how to go about the dynamic arranging of images onto the page without them being half chopped off. Ideally they will just be arranged onto a HTML page which I can just add a print button to. Any suggestions are most welcome
  9. Thanks for your post nafetski its application/msword though are there any benefits of parsing from the filename rather than using the file type? also, how would I go about clipping the extension from the filename as some extensions are 4 characters and some are 3?
  10. ok figured this one out by uploading the files and then using zip.lib.php to zip the individual files on the server side, name it how i want and then unlink the individual files. Can someone help with the filetype validation though... foreach ($_FILES as $_key => $_value) { if ($_FILES[$_key]['size'] < 2000000 && ($_FILES[$_key]['type'] == "application/pdf")) { print_r($_FILES[$_key]); move_uploaded_file($_FILES["$_key"]["tmp_name"], "c:/wamp/www/attachments/" . $_FILES["$_key"]["name"]); echo "Stored in: " . "upload/" . $_FILES["$_key"]["name"]; } else { echo $_FILES[$_key]['name'] . ' is invalid'; } } So $_FILES[$_key]['type'] == "application/pdf" will let pdf files be uploaded, but what is the equivelent for word documents (.doc not .docx)? tried $_FILES[$_key]['type'] == "application/doc" but unfortunately life isnt that simple Thanks
  11. If it was for me that would be fine, but i'm building a system for non technical users and would like to make it as easy for them as possible. It is also useful for me if the function can rename the zip file to keep a consitent naming convention without having to have another database table to relate the zip file to a particular record.
  12. Does anyone know of any functions which allow you to upload multiple files to a webserver and saves them there as a ZIP archive automatically? Thanks
  13. Out of interest, why does the space not make a difference when developing locally but has an impact online?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.