SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Enthusiast theharmonyguy's Avatar
    Join Date
    Aug 2004
    0 Post(s)
    0 Thread(s)

    Changing form method programatically

    I have a personal blog using WordPress, but I have so many friends using a hosted blog service that I also have an account there. I don't have access to all the HTML in the hosted service, but I found that with the right JavaScript you can change a lot (JS code can be inserted into the page).

    What I'm trying to do is change the built-in search form to point to the search functionality on my WP blog. But the search form has method="post" in the HTML, and I want to use method="get". Either actually works, but using "get" the search terms are highlighted in the results page.

    The form has an onsubmit event handler, so I modify it in my code like this (I change the action property elsewhere):
    function search(keywords)
    document.searchform.method = "get";
    I've even used window.alert to make sure that document.searchform.method is in fact "get". But every time I click the submit button, the form is submitted to my WP site using post! I've tried everything I can think of to make it use "get" instead, but to no avail.
    Last edited by theharmonyguy; Feb 19, 2005 at 13:02.


Posting Permissions

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