Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 720601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:46:38+00:00 2026-05-14T05:46:38+00:00

We have a very long form that has a number of fields and 2

  • 0

We have a very long form that has a number of fields and 2 different submit buttons. When a user clicks the 1st submit button (“Photo Search”) the form should POST and our script will do a search for matching photos based on what the user entered in the text input (“photo_search_text”) next to the 1st submit button and reload the entire form with matching photos added to the form. Upon clicking the 2nd submit button (“Save Changes”) at the end of the form, it should POST and our script should update the database with the information the user entered in the form.

Unfortunately the layout of the form makes it impossible to separate it into 2 separate forms. I checked the entire form POST and unfortunately the submitted fields are identical to the perl script processing the form submission no matter which submit button is clicked so the perl script can’t differentiate which action to perform based on which submit button is pushed. The only thing I can think of is to update the onclick action of the 2nd submit button so it clears the “photo_search_text” field before the form is submitted and then only perform a photo search if that fields has a value.

Based on all this, my question is what does the JavaScript look that could clear out the “photo_search_text” field when someone clicks on the 2nd submit button? Here is what I’ve tried so far none of which has worked successfully:

<input type="submit" 
       name="submit" 
       onclick="document.update-form.photo_search_text.value='';" 
       value="Save Changes"
>

<input type="submit" 
       name="submit" 
       onsubmit="document.update-form.photo_search_text.value='';" 
       value="Save Changes"
>

<input type="submit" 
       name="submit" 
       onclick="document.getElementById('photo_search_text')='';" 
       value="Save Changes"
>

We also use JQuery on the site so if there is a way to do this with jQuery instead of plain JavaScript feel free to provide example code for that instead. Lastly, if there is another way to handle this that I’m not thinking of any and all suggestions would be welcome.

Thanks in advance for your help!

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T05:46:38+00:00Added an answer on May 14, 2026 at 5:46 am

    If you give the input an ID like this:

    <input ID="nosearch" type="submit" name="submit" value="Save Changes">
    

    You can do it via jQuery a bit easier, like this:

    $(function() {
      $("#nosearch").click(function() {
        $("#photo_search_text").val("");
      });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Tricky question. I have a very long form where the user writes down a
I have a very long horizontal form that is separated into multiple sub-forms, acting
I have very long integer sequences that look like this (arbitrary length!): 0000000001110002220033333 Now
I have a very long javascript (so long that it's too long to escape
As background I have a very long ID that too long to display in
I have a number of very long arrays. No run-time sort is possible. It
I have a submit form that displays into a list format and I'm wondering
I have a very long activity with a scrollview. It is a form with
I am setting up a registration form. This form has 7 fields that are
I have a web form against a white background that allows the user to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.