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 6218063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:32:22+00:00 2026-05-24T07:32:22+00:00

I have the following form from http://regain.sourceforge.net/ : <form name=search action=search.jsp method=get> <p class=searchinput>

  • 0

I have the following form from http://regain.sourceforge.net/:

<form name="search" action="search.jsp" method="get">
        <p class="searchinput">
          <b>Suchen nach: </b>
          <input name="query" size="30"/>
          <select name="order" size="1" ><option selected value="relevance_desc">Relevanz</option><option value="last-modified_asc">Dokumentendatum aufsteigend</option><option value="last-modified_desc">Dokumentendatum absteigend</option</select>

          <input type="submit" value="Suchen"/>
         </p>
      </form>

the search form works fine. The URL looks like the following:
http://localhost:8080/regain/search.jsp?query=queryfieldvalue&order=relevance_desc

Now I want to add a checkbox to manipulate the value of the input field query.
If the checkbox is checked then the query value should look like filename:”queryfieldvalue“

http://localhost:8080/regain/search.jsp?query=filename%3A%22queryfieldvalue%22&order=relevance_desc

What’s the best way to do this? Javascript? Do you have a short example for me because I’m really new to javascript.

Thanks a lot in advance.

  • 1 1 Answer
  • 0 Views
  • 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-24T07:32:23+00:00Added an answer on May 24, 2026 at 7:32 am

    one way with pure javascript (without jquery) would be

    <script type="text/javascript">
    function handler()
    {
        var check = document.getElementById('check');
        var query = document.getElementsByName('query')[0];
        if(check.checked)
        {
            query.value = "filename:\"" + query.value + "\"";
        }
        else
        {
            query.value = query.value.replace(/^filename:"/, "").replace(/"$/, "");
        }
    }
    </script>
    
    <form>
        <input type="text" name="query" />
        <input type="checkbox" id="check" onclick="handler()" />box
    </form>
    

    it should more or less work, it would be safer if you give query input field an id and then reference it by id, not name

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following form: <form action= method=get> <input name=form1 type=radio onclick=document.forms[0].testbox.value='0.00'; /> <input
I have the following form <form name=myForm id=myForm method=post enctype=multipart/form-data action=script.php> and this jQuery
I have the following code (inherited from someone): <div class=feedback>&nbsp;</div> <form onsubmit=return false autocomplete=off>
in the form action i have the following line\ <form action={URL} method=post target=_self id=xxx
I have the following form in cakephp: <div class=quickcontactDisplay> <?php echo $form->create('Enquiry',array('action'=>'add','class'=>'quickcontact')); echo $form->hidden('visitor_id',
I have following HTML form <form action=https://sandbox.paypal.com/cgi-bin/webscr method=post id=paypalpost name=paypalpost> <input type=hidden name=rm value=2/>
I have the following script which creates an email from a contact form: http://codeviewer.org/view/code:1b54
In every form we derive from FormBaseControl , we have the following code. I'm
I have the following form code: # forms.py class SomeForm(forms.Form): hello = forms.CharField(max_length=40) world
i have the following form item { fieldLabel:'Username' ,id:username ,name:'username' ,allowBlank:false ,plugins:[Ext.ux.plugins.RemoteValidator] ,rvOptions: {

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.