Results 1 to 5 of 5

Thread: Having trouble with me on click

  1. #1
    Join Date
    Nov 2011
    Location
    Cider Region
    Posts
    1,132
    Thanks
    158
    Thanked 3 Times in 3 Posts

    Default Having trouble with me on click

    Here are 2 pages for example,
    #1 http://www.theremotedoctor.co.uk/accaudi.html
    #2 http://www.theremotedoctor.co.uk/facporsche.html

    I am trying to self populate a form with a part number when the order button has been clicked.
    The problem i am having is that i can only fetch one part number even if say 2,3 or 4 are available.

    Example.
    If you visit #1 link above you will see there is only 1 selectable item " Flip remote key pad"
    When selected the image is then shown.
    Click on Order & the form appears with the part number inserted Audi002

    If you now visit #2 link above you will see there are 2 selectable items "Shell case 2 button & Shell case 3 button"
    Do the same again in respect of viewing & order and no matter which you select you will see that only part number Porsche001 has been inserted.

    This is the code that i have inserted but i do not know how to add/edit it for the second selectable item

    <a href="http://form.jotformeu.com/form/50907214204344?partNumber=Porsche001" target="_new">

    Thanks
    Last edited by theremotedr; 04-12-2015 at 07:33 PM.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The main problem seems to be that btnOrder2 is not the button that is seen on the page and is clicked to summon the form. In my suggested solution (works in limited testing) I select the actual link/button. I also employ a shortcut - accessing the link's search property instead of its entire href in order to get the desired result.

    Change:

    Code:
            function replaceMainImage(imgSrc, partNumber) {
    
                $('#btnOrder2').attr('href', url + partNumber)
                $('#mainImage').attr('src', imgSrc)
                $('#mainImage').addClass('img-border');
            }
    to:

    Code:
    	function replaceMainImage(imgSrc, partNumber) {
    
                $('#content a').get(0).search = 'partNumber=' + partNumber;
                $('#mainImage').attr('src', imgSrc);
                $('#mainImage').addClass('img-border');
            }
    Using the entire href is probably fine if you still want to. The main issue is selecting and changing the correct a tag - the one that's actually used.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Nov 2011
    Location
    Cider Region
    Posts
    1,132
    Thanks
    158
    Thanked 3 Times in 3 Posts

    Default

    Now works perfect,thanks very much.
    Maybe you can also advise an edit for this.
    If no selection is made and you just click on order the form opens up and the part number section is blank.
    Can you advise how to disable this happening,in respect of clicking the order button & maybe show "please make selection" etc

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That's easy, do two things. On the page with the parts change:

    Code:
    <!-- content area -->    
                    <section id="content">                <img src="m-images/dr-logo.jpg" id="mainImage"  />
    <a href="http://form.jotformeu.com/form/50907214204344?partNumber=Porsche001" target="_new">                <img src="m-images/order-button.jpg" width="287" height="92" alt="Order Button" class="border"/></a>
                    <img src="m-images/info-button.jpg" alt="logo" width="287" height="92" class="border"></a>
                    </section>
    <!-- #end content area -->
    to (remove red):

    Code:
    <!-- content area -->    
                    <section id="content">                <img src="m-images/dr-logo.jpg" id="mainImage"  />
    <a href="http://form.jotformeu.com/form/50907214204344" target="_new">                <img src="m-images/order-button.jpg" width="287" height="92" alt="Order Button" class="border"/></a>
                    <img src="m-images/info-button.jpg" alt="logo" width="287" height="92" class="border"></a>
                    </section>
    <!-- #end content area -->
    Then, on the form page, add the red:

    Code:
            <div id="cid_9" class="form-input-wide jf-required">
              <select class="form-dropdown validate[required]" style="width:150px" id="input_9" name="q9_partNumber">
                <option value="">Please Select</option>
                <option value="Audi001"> Audi001 </option>
                <option value="Audi002"> Audi002 </option>
                <option value="Bmw001"> Bmw001 </option>
                <option value="Bmw0 . . .
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Nov 2011
    Location
    Cider Region
    Posts
    1,132
    Thanks
    158
    Thanked 3 Times in 3 Posts

    Default

    Spot on,thanks

Similar Threads

  1. Resolved One Click Stopping Second Click
    By Deadweight in forum JavaScript
    Replies: 2
    Last Post: 10-15-2013, 03:54 AM
  2. Having trouble with Div
    By Unruffled in forum CSS
    Replies: 5
    Last Post: 04-11-2012, 04:01 PM
  3. auto click using .click()
    By ajmalhuuss in forum JavaScript
    Replies: 2
    Last Post: 05-28-2010, 04:01 PM
  4. A question about click and double-click
    By Tohaki in forum JavaScript
    Replies: 4
    Last Post: 11-17-2008, 07:58 AM
  5. Image change on click, changeback on click
    By Racuda in forum Looking for such a script or service
    Replies: 2
    Last Post: 07-23-2007, 05:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •