SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jan 2003
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Getting a variable from a form element without submitting the form

    Hi. I've got the setup below, which doesn't work. The hrefs are a collection of rows from a db with an 'edit' href next to each line. At the bottom is a password box - the value of which is checked by the DELETE php function above.

    It is in a form, but as there's an edit href against each line the form obviously isn't used for that purpose (submitting the form serves another purpose). But of course the password box is also in the form and I'm trying to pass the value with javascript to the href="thispage.php?password=" part.

    Hope you see what I'm getting at. I want to access the password box with javascript but NOT submit the form.

    Can someone please help me out? Many thanks.

    if ($password=="hello") {
    $sql="DELETE..."
    }

    and much lower down:


    <form name="shw">

    <a href="samepage.php?password='javascript:document.shw.password.value;'">

    ...and other similar rows from the database...

    <input type="password" name="password">
    </form>
    Thanks
    whataday

  2. #2
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    is this what you mean?

    <input type="password" name="password" onBlur="doSomething(this.value)">
    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still

  3. #3
    SitePoint Member
    Join Date
    Jan 2003
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, I don't think so. Clicking the href reloads the page (i.e. it points to the name of the current page). I want it to pick up the password value before it goes.
    Thanks
    whataday


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
  •