Advertisement:

Author Topic: Needs help! script hide radio field add item post page  (Read 679 times)

Rotchel C

  • Newbie
  • *
  • Posts: 20
Needs help! script hide radio field add item post page
« on: December 10, 2016, 05:36:31 am »
Hi guys i add some radio fields on my item post page:

        <div id="property-type">
          <div class="property-ads-100">
            <label>
              <span class="required_fields">* </span>
              <?php _e('Property Type:', 'ctg_housing'); ?>
            </label>
          </div>
            <?php
              $itemtype1 = '';$itemtype2 = '';$itemtype3 = '';$itemtype4 = '';
              if(!empty($s_furnished)){
              if($s_furnished=='bare-unit'){
                $itemtype1 = 'checked = "checked"';
                }
              else if($s_furnished=='unfurnished'){
                $itemtype2 = 'checked = "checked"';
                }
              else if($s_furnished=='semi-furnished'){
                $itemtype3 = 'checked = "checked"';
                }
              else if($s_furnished=='fully-furnished'){
                $itemtype4 = 'checked = "checked"';
                }
              }
            ?>
          <div class="property-ads-100">
            <div class="small-radio medium-radio large-radio">
              <input id="s_furnished" name="s_furnished" type="radio" value="bare-unit" <?php echo $itemtype1;?>>
              <label for="s_furnished">
                <?php _e('Bare Unit', 'ctg_housing'); ?>
              </label>
            </div>
            <div class="small-radio medium-radio large-radio">
              <input id="s_furnished" name="s_furnished" type="radio" value="unfurnished" <?php echo $itemtype2;?>>
              <label for="s_furnished">
                <?php _e('Unfurnished', 'ctg_housing'); ?>
              </label>
            </div>
            <div class="small-radio medium-radio large-radio">
              <input id="s_furnished" name="s_furnished" type="radio" value="semi-furnished" <?php echo $itemtype3;?>>
              <label for="s_furnished">
                <?php _e('Semi-Furnished', 'ctg_housing'); ?>
              </label>
            </div>
            <div class="small-radio medium-radio large-radio">
              <input id="s_furnished" name="s_furnished" type="radio" value="fully-furnished" <?php echo $itemtype4;?>>
              <label for="s_furnished">
                <?php _e('Fully Furnished', 'ctg_housing'); ?>
              </label>
            </div>
          </div>
        </div>

Now i look how to make a script how to hide this until selected the category.
But this field needs to hide on some categories!
How to do this?

This are all my categories and Subcategories!

<select id="select_1" name="select_1" depth="1" class="valid">
  <option value="0">Select category</option>
    <option value="43">For Rent</option>
     <select id="select_2" name="select_2" depth="2" class="valid">
       <option value="43">Select subcategory</option>
      <option value="42">Boarding House</option>
      <option value="41">Studio</option>
      <option value="40">Apartment</option>
      <option value="39">Condominium</option>
      <option value="38">Penthouse</option>
      <option value="37">Townhouse</option>
      <option value="36">House and Lot</option>
      <option value="35">Villa</option>
      <option value="34">Lot Only</option>
     </select>
   <option value="33">For Sale</option>
     <select id="select_2" name="select_2" depth="2" class="valid">
       <option value="33">Select subcategory</option>
      <option value="32">Studio</option>
      <option value="31">Apartment</option>
      <option value="30">Condominium</option>
      <option value="29">Penthouse</option>
      <option value="28">Townhouse</option>
      <option value="27">House and Lot</option>
      <option value="26">Villa</option>
      <option value="25">Lot Only</option>
     </select>
   <option value="24">Pre-Selling</option>
      <select id="select_2" name="select_2" depth="2" class="valid">
       <option value="24">Select subcategory</option>
      <option value="23">Studio</option>
      <option value="22">Apartment</option>
      <option value="21">Condominium</option>
      <option value="20">Penthouse</option>
      <option value="19">Townhouse</option>
      <option value="18">House and Lot</option>
      <option value="1">Villa</option>
     </select>
   <option value="5">Vacation</option>
     <select id="select_2" name="select_2" depth="2" class="valid">
       <option value="5">Select subcategory</option>
       <option value="4">Pension House</option>
      <option value="3">Inn / Motel</option>
      <option value="2">Hotel &amp; Resort</option>
      </select>
   <option value="10">Commercial</option>
     <select id="select_2" name="select_2" depth="2" class="valid">
       <option value="10">Select subcategory</option>
      <option value="9">Office</option>
      <option value="8">Space</option>
      <option value="7">BPO</option>
      <option value="6">Economic</option>
     </select>
   <option value="14"> Industrial</option
     <select id="select_2" name="select_2" depth="2" class="valid">
       <option value="14">Select subcategory</option>
      <option value="13">Warehouse</option>
      <option value="12">Industrial Land</option>
      <option value="11">Agriculture Land</option>
     </select>
   <option value="17">Other</option>
     <select id="select_2" name="select_2" depth="2" class="valid">
       <option value="17">Select subcategory</option>
      <option value="16">Building</option>
      <option value="15">Beach &amp; Resort</option>
     </select>
  </select>

The Property field needs to show on the next Categories and Subcategories:

<select id="select_1" name="select_1" depth="1" class="valid">
  <option value="0">Select category</option>
    <option value="43">For Rent</option>
     <select id="select_2" name="select_2" depth="2" class="valid">
       <option value="43">Select subcategory</option>
      <option value="42">Boarding House</option>
      <option value="41">Studio</option>
      <option value="40">Apartment</option>
      <option value="39">Condominium</option>
      <option value="38">Penthouse</option>
      <option value="37">Townhouse</option>
      <option value="36">House and Lot</option>
      <option value="35">Villa</option>
     </select>
   <option value="33">For Sale</option>
     <select id="select_2" name="select_2" depth="2" class="valid">
       <option value="33">Select subcategory</option>
      <option value="32">Studio</option>
      <option value="31">Apartment</option>
      <option value="30">Condominium</option>
      <option value="29">Penthouse</option>
      <option value="28">Townhouse</option>
      <option value="27">House and Lot</option>
      <option value="26">Villa</option>
     </select>
   <option value="24">Pre-Selling</option>
      <select id="select_2" name="select_2" depth="2" class="valid">
       <option value="24">Select subcategory</option>
      <option value="23">Studio</option>
      <option value="22">Apartment</option>
      <option value="21">Condominium</option>
      <option value="20">Penthouse</option>
      <option value="19">Townhouse</option>
      <option value="18">House and Lot</option>
      <option value="1">Villa</option>
     </select>
  </select>

And hide on the next Categories and Subcategories:

<select id="select_1" name="select_1" depth="1" class="valid">
  <option value="0">Select category</option>
    <option value="43">For Rent</option>
     <select id="select_2" name="select_2" depth="2" class="valid">
       <option value="43">Select subcategory</option>
      <option value="34">Lot Only</option>
     </select>
   <option value="33">For Sale</option>
     <select id="select_2" name="select_2" depth="2" class="valid">
       <option value="33">Select subcategory</option>
      <option value="25">Lot Only</option>
     </select>
   <option value="5">Vacation</option>
     <select id="select_2" name="select_2" depth="2" class="valid">
       <option value="5">Select subcategory</option>
       <option value="4">Pension House</option>
      <option value="3">Inn / Motel</option>
      <option value="2">Hotel &amp; Resort</option>
      </select>
   <option value="10">Commercial</option>
     <select id="select_2" name="select_2" depth="2" class="valid">
       <option value="10">Select subcategory</option>
      <option value="9">Office</option>
      <option value="8">Space</option>
      <option value="7">BPO</option>
      <option value="6">Economic</option>
     </select>
   <option value="14"> Industrial</option
     <select id="select_2" name="select_2" depth="2" class="valid">
       <option value="14">Select subcategory</option>
      <option value="13">Warehouse</option>
      <option value="12">Industrial Land</option>
      <option value="11">Agriculture Land</option>
     </select>
   <option value="17">Other</option>
     <select id="select_2" name="select_2" depth="2" class="valid">
       <option value="17">Select subcategory</option>
      <option value="16">Building</option>
      <option value="15">Beach &amp; Resort</option>
     </select>
  </select>

Hope someone can help me, i'm new in this!

Thanks

Liath

  • issues
  • Hero Member
  • *
  • Posts: 1346
  • </html> the end is always near
Re: Needs help! script hide radio field add item post page
« Reply #1 on: December 10, 2016, 05:42:33 am »
for a better readability, pls edit your post and make use of the code-tags... after that we can look about your problem :)

Rotchel C

  • Newbie
  • *
  • Posts: 20
Re: Needs help! script hide radio field add item post page
« Reply #2 on: December 10, 2016, 05:51:47 am »
This is the code i add in the item post,
i add above all the categories and subcategories on what i want to hide and show it.

Thanks

        <div id="property-type">
          <div class="property-ads-100">
            <label>
              <span class="required_fields">* </span>
              <?php _e('Property Type:', 'ctg_housing'); ?>
            </label>
          </div>
            <?php
              $itemtype1 = '';$itemtype2 = '';$itemtype3 = '';$itemtype4 = '';
              if(!empty($s_furnished)){
              if($s_furnished=='bare-unit'){
                $itemtype1 = 'checked = "checked"';
                }
              else if($s_furnished=='unfurnished'){
                $itemtype2 = 'checked = "checked"';
                }
              else if($s_furnished=='semi-furnished'){
                $itemtype3 = 'checked = "checked"';
                }
              else if($s_furnished=='fully-furnished'){
                $itemtype4 = 'checked = "checked"';
                }
              }
            ?>
          <div class="property-ads-100">
            <div class="small-radio medium-radio large-radio">
              <input id="s_furnished" name="s_furnished" type="radio" value="bare-unit" <?php echo $itemtype1;?>>
              <label for="s_furnished">
                <?php _e('Bare Unit', 'ctg_housing'); ?>
              </label>
            </div>
            <div class="small-radio medium-radio large-radio">
              <input id="s_furnished" name="s_furnished" type="radio" value="unfurnished" <?php echo $itemtype2;?>>
              <label for="s_furnished">
                <?php _e('Unfurnished', 'ctg_housing'); ?>
              </label>
            </div>
            <div class="small-radio medium-radio large-radio">
              <input id="s_furnished" name="s_furnished" type="radio" value="semi-furnished" <?php echo $itemtype3;?>>
              <label for="s_furnished">
                <?php _e('Semi-Furnished', 'ctg_housing'); ?>
              </label>
            </div>
            <div class="small-radio medium-radio large-radio">
              <input id="s_furnished" name="s_furnished" type="radio" value="fully-furnished" <?php echo $itemtype4;?>>
              <label for="s_furnished">
                <?php _e('Fully Furnished', 'ctg_housing'); ?>
              </label>
            </div>
          </div>
        </div>

Rotchel C

  • Newbie
  • *
  • Posts: 20
Re: Needs help! script hide radio field add item post page
« Reply #3 on: December 10, 2016, 04:24:08 pm »
Some help please