SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Aug 2005
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Use text links to submit a form

    Hi this is a jquery question.

    I want to use a text link to submit a form and get the POST values instead of an ugly submit button which is difficult to style. I thought it would be simple but I can't do it - whats the problem with this .js?

    <script>

    $(document).ready(function() {

    $('#link1').click(function() {
    $('#form1').submit();
    return false
    });

    });

    </script>

    The problem is I can't get the $_POST variables to perform some conditional logic. I want the user to answer a question submit the form to itself and test the result.

    I can do this fine with a submit button but a text link styled as a button looks much better. Do I have to use ajax() function or something to send the from variables to a PHP script?

    </script>

  2. #2
    SitePoint Guru downtroden's Avatar
    Join Date
    Dec 2004
    Location
    illinois
    Posts
    970
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how about using
    <button type="submit"><!--- all the styling tags you can stuff in --></button>
    instead?
    your brain reacts in the same way whether you are
    looking at something or thinking about it...

  3. #3
    SitePoint Addict
    Join Date
    Aug 2005
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You are right - I should have thought of that first. I think I stopped using button tags because of some minor IE bug but they can be styled and will submit in all browsers.

    Thanks for reminding me!
    Steven


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
  •