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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:29:53+00:00 2026-06-18T09:29:53+00:00

I have a form with 2 text fields that trigger a jquery date picker.

  • 0

I have a form with 2 text fields that trigger a jquery date picker.

I want to set empty values to both text field by unchecking a checkbox that is in the same form.

The text fields are:

<?php 
   if ($_GET["arrival"]== "") 

   echo ' 
   <label for="arrival">Arrival </label>
   <input type="text" name="arrival" class="w8em format-d-m-y highlight-days-67 range-low-today" id="arrival" value="Select Date"/> ';

   else

   echo ' 
   <label for="arrival">Arrival </label>
   <input type="text" name="arrival" class="w8em format-d-m-y highlight-days-67 range-low-today" id="arrival" value="' . $_GET["arrival"] . '"/> '; 
   ?>

<?php

   if ($_GET["departure"]== "") 

   echo ' 
   <label for="departure">Departure </label>
   <input type="text" name="departure" class="w8em format-d-m-y highlight-days-67 range-low-today" id="departure" value="Select Date"/> ';  

    else

    echo ' 
    <label for="departure">Departure </label>
    <input type="text" name="departure" class="w8em format-d-m-y highlight-days-67 range-low-today" id="departure" value="' . $_GET["departure"] . '"/> '; 
    ?>

The checkbox is:

<input name="avail" type="checkbox" id="avail"
                 <?php if ($_GET["avail"]== "1") echo "checked=\"checked\""; ?>
                 value="1" />

I want by deselecting it to set empty values to text fields.

  • 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-06-18T09:29:54+00:00Added an answer on June 18, 2026 at 9:29 am

    You can use jquery for make it working.

    checkbox onclick event you can set empty value for textfield.

    <script>
            function empty()
            {
               if($("#avail:checked").length > 0)
               {
                  $('#arrival').val('');
                  $('#departure').val('');
               }
            }
    </script>
    

    Add onclick event on checkbox

    <input name="avail" type="checkbox" id="avail"
                 <?php if ($_GET["avail"]== "1") echo "checked=\"checked\""; ?>
                 value="1" onclick="empty();"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an order form with about 30 text fields that contain numerical values.
I have a form that has 3 types of field: (2) text fields that
So I have a multipart form that has fields for text, integers and file
I want to have a Form that can Add or Delete TextFields. I was
I have problem with TinyMCE editor. I have form with few text fields and
I have one form with several text fields and one button. When i enter
I have a form with 3 text fields and 3 checkboxes. I had implemented
I have a form with an array of text fields. The user (through javascript)
I have a big registration form that I've devided with jquery cycle so you
I have a form field which uses Jorn Zaefferer's autocomplete jQuery plugin. If i

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.