Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    New Coder
    Join Date
    Jun 2008
    Posts
    67
    Thanks
    18
    Thanked 0 Times in 0 Posts

    help with images

    Good afternoon I am trying to make a form and keep getting stuck on one thing, don't know if JavaScript is the way to go so any advise would be helpful.
    basicly i have a form
    giftcert.html -that has text input boxes the user fills in and a link to the next page for the user to pick a gift card
    giftcards.asp -the user picks a gift card by radio buttons (over 100)grouped by name and then pushes a button to take them to the next page passing the value of the radio and image (here is the issue)
    giftcert.asp -this page displays the text boxes from the first page with the value already present (used asp to achieve) and the value of the radio button (a stock number - used asp to achieve) and i want a sample of the image attached to the stock number.
    how do i pass the image attached to the radio button from giftcards.asp to giftcert.asp
    i don't know where i am going wrong
    a) how do i attach the image to the button do i use an onclick="pass src" and how
    b) how do i get the image to show up in giftcert.asp

  • #2
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    Radio buttons are inputs - they have values. The values are passed to the next form in the chain. Associate the values with the images.
    Are you a Help Vampire?

  • #3
    New Coder
    Join Date
    Jun 2008
    Posts
    67
    Thanks
    18
    Thanked 0 Times in 0 Posts
    but the values with the radio buttons are already there with a stock number (example bba-003) that goes to a text box on the next page with asp.
    i need to have the image go also to the next page to a diff location on the page
    this is way i am lost

    is there a way of assigning two values to a radio button?

  • #4
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    No, but you can associate the values with the image filenames in your ASP code. So, if you get bba-003 as the value, then you can use the filename little_blue_teapot.jpg, or whatever. Otherwise, you could pass all of the filenames in hidden inputs.
    Are you a Help Vampire?

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,155
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    You *could* do this:
    Code:
    <label>
    <input type="radio" name="whatever" value="173::heartsAndLions.jpg" />
    <img src="images/heartsAndLions.jpg" /></label>
    
    <label>
    <input type="radio" name="whatever" value="401::bunnies.jpg" />
    <img src="images/bunnies.jpg" /></label>
    
    ... etc. ...
    And then, in the subsequent ASP page, you would do:
    Code:
    <%
    temp = Split( Request("whatever"), "::" )
    If UBound(temp) = 1 Then
        cardNumber = CINT(temp(0))
        imageName = temp(1)
    End If
    ...
    Nobody ever said you couldn't send more than one piece of information as the value= of a form field, you know.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #6
    New Coder
    Join Date
    Jun 2008
    Posts
    67
    Thanks
    18
    Thanked 0 Times in 0 Posts
    i would like to try but dont know how to go about associating the values with the image filenames in my ASP code,
    because i was trying to pass hidden inputs but cant get it to work with the radio buttons

  • #7
    New Coder
    Join Date
    Jun 2008
    Posts
    67
    Thanks
    18
    Thanked 0 Times in 0 Posts
    i tried to put it into plan but got this error

    Microsoft VBScript runtime error '800a000d'

    Type mismatch: 'CINT'

    /index/GIFTCERTIFICATE.asp, line 500

    plus the image is already placed in the table the row above.

    maybe you can see something i don't see or the more likely story just don't understand
    so i included the links
    page 1
    http://www.allyscandle.com/index/GIFTCERTIFICATES.html
    no issues from pg 1 to 2

    page 2
    http://www.allyscandle.com/index/GIFTCARDS.asp
    issues are from 2 to 3

    page 3 - end page before submit
    http://www.allyscandle.com/index/GIFTCERTIFICATE.asp

  • #8
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,155
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    You wrote both pages, didn't you?

    How did you associate a particular image with a particular radio button on the page where both are showing???? Why can't you do the same thing on the page the <form> posts to?

    Anyway, I don't see how I can make any further guesses without seeing your code.

    And I seriously doubt that this thread belongs in the JavaScript forum, in any case.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #9
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,155
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    Spoke too soon. LOL.

    Okay, but even on the first page I get a whole series of JavaScript errors.

    This line, for example:
    Code:
     var gsn = (location.href.split('giftcardstocknumber=')[1].split('&')[0]).replace(/\+/g,' ');
    CLEARLY the url (according to the address bar) is simply:
    Code:
    http://www.allyscandle.com/index/GIFTCERTIFICATES.html
    so there is no "giftcardstocknumber=" to split on! So clearly you can't get the [1] element of the non-existent array that results from the split.

    Firebug also complains about
    Code:
     $mainmenu.parent().get(0).className=setting.classname || "ddsmoothmenu"
    but that's jQuery, I guess, and I don't know what is wrong there.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #10
    New Coder
    Join Date
    Jun 2008
    Posts
    67
    Thanks
    18
    Thanked 0 Times in 0 Posts
    I put the links up
    i did not associate the radio button and image they are both in a table layout
    as far as names the image is named GIFTCARDS/003 BASIC FLOWER.jpg
    and the radio button is named giftcardstocknumber with a value of bba-003

    as for this code in giftcert.html i have to remove it. it was one of the things i was trying to get the first form to work before i went to asp.
    Code:
    var gsn = (location.href.split('giftcardstocknumber=')[1].split('&')[0]).replace(/\+/g,' ');

  • #11
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,155
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    This code makes no sense:
    Code:
    <td><span class="style71"><label><input name="giftcardstocknumber" type="radio" value="BBA - 004"
          />Style-<input type="hidden" id="bba004" name="pickimage" value="GIFTCARDS/004 BASIC4.jpg"/>BBA 004</label></span>
    </td>
    Those hidden fields, all with the same name (pickimage) are useless.

    On the next ASP page, if you do
    Code:
    pickimage = Request("pickimage")
    you are going to get a list of *EVERY SINGLE ONE* of those, in the form:
    Code:
    GIFTCARDS/004 BASIC4.jpg, GIFTCARDS/005 BASIC5.jpg, ...all of them...
    Totally useless.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #12
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,155
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    Well, I have to go now. Look at my suggestion for the value= of your radio buttons. It's really by far the simplest way.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

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