Advertisement:

Author Topic: Guys Urgent some help please item post  (Read 1083 times)

Rhoda

  • Jr. Member
  • **
  • Posts: 92
Guys Urgent some help please item post
« on: March 24, 2017, 06:28:53 pm »
Hi Guys i'am a student and needs some help!

I try to hide some div fields after you select a category!

This div field need to be hide
Code: [Select]
<div class="item-post-lot-area">
for this categories:

Code: [Select]
  <select id="catId" name="catId" class="valid">
<option value="2">Boarding House</option>
<option value="3">Studio</option>
<option value="4">Apartment</option>
<option value="5">Condominium</option>
<option value="6">Penthouse</option>
  </select>
  <select id="catId" name="catId" class="valid">
    <option value="11">Select Subcategory</option>
<option value="12">Studio</option>
<option value="13">Apartment</option>
<option value="14">Condominium</option>
<option value="15">Penthouse</option>
  </select>

How to do this?

Thanks

fog

  • Hero Member
  • *****
  • Posts: 1062
Re: Guys Urgent some help please item post
« Reply #1 on: March 24, 2017, 07:04:52 pm »
Hi, first you have duplicate ID on your selectors. So you need use different ID for both, or javascript will not work for specific ID to do something by ID. No make sense to HTML structure with your selectors with same ID, not will works, or you will have problems / errors.

See how you can do what you need with a basic example, here

Rhoda

  • Jr. Member
  • **
  • Posts: 92
Re: Guys Urgent some help please item post
« Reply #2 on: March 24, 2017, 07:20:50 pm »
Hi, thanks for your reply!

What i mean is to hide the div after you select a subcategory!
you can hide this by the value value="nr " with a script right?

fog

  • Hero Member
  • *****
  • Posts: 1062
Re: Guys Urgent some help please item post
« Reply #3 on: March 24, 2017, 07:51:48 pm »
Yes, but I think you are trying to do it on selectors of osclass core. Just confused, why you posted two selectors with same ID and with repeated categories? Or you trying to use your own selectors? Initially it was what I thought, your own selectors. Please, explain a little better.

fog

  • Hero Member
  • *****
  • Posts: 1062
Re: Guys Urgent some help please item post
« Reply #4 on: March 24, 2017, 07:59:35 pm »
Try following with this example here

I not test it, but you need to do it by your self. Use the console inspector of firefox to help you better (F12).

Regards

Rhoda

  • Jr. Member
  • **
  • Posts: 92
Re: Guys Urgent some help please item post
« Reply #5 on: March 24, 2017, 08:04:37 pm »
ok the reason i have 2 times same!

This our the categories i use!

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

Rhoda

  • Jr. Member
  • **
  • Posts: 92
Re: Guys Urgent some help please item post
« Reply #6 on: March 24, 2017, 08:05:40 pm »
My mind is to add a script to hide this in the item post!

Do you have a example script for this?

Thanks

fog

  • Hero Member
  • *****
  • Posts: 1062
Re: Guys Urgent some help please item post
« Reply #7 on: March 24, 2017, 08:16:55 pm »
But your HTML5 structure is wrong. You cannot use <select> inside of other(s) <select>, or I feeling old. What the reason to you do this? He works to you like this?

Why you not use the osclass core selectors, and editing the condition javascript you can get what you need?

You said, you need hide this... do you mean your own selectors? Now I'm confused  ???

Rhoda

  • Jr. Member
  • **
  • Posts: 92
Re: Guys Urgent some help please item post
« Reply #8 on: March 24, 2017, 08:21:44 pm »
I copy the categories and subcategories by the inspector element

that is why you have still the select!


Rhoda

  • Jr. Member
  • **
  • Posts: 92
Re: Guys Urgent some help please item post
« Reply #9 on: March 24, 2017, 08:25:01 pm »
Ok will try to explain it other way!

This are my categories!

Code: [Select]
<select id="parentCategory" name="parentCatId">
  <option value="">Select Category</option>
    <option value="1">For Rent</option>
<option value="11">For Sale</option>
<option value="20">Pre-Selling</option>
<option value="28">Vacation</option>
<option value="32">Commercial</option>
<option value="37"> Industrial</option>
<option value="42">Other</option>
</select>

Rhoda

  • Jr. Member
  • **
  • Posts: 92
Re: Guys Urgent some help please item post
« Reply #10 on: March 24, 2017, 08:26:07 pm »
This are the subcategories i use!

Code: [Select]
  <select id="catId" name="catId" class="valid">
    <option value="1">Select Subcategory</option>
<option value="2">Boarding House</option>
<option value="3">Studio</option>
<option value="4">Apartment</option>
<option value="5">Condominium</option>
<option value="6">Penthouse</option>
<option value="7">Townhouse</option>
<option value="8">House and Lot</option>
<option value="9">Villa</option>
<option value="10">Lot Only</option>
  </select>

  <select id="catId" name="catId" class="valid">
    <option value="11">Select Subcategory</option>
<option value="12">Studio</option>
<option value="13">Apartment</option>
<option value="14">Condominium</option>
<option value="15">Penthouse</option>
<option value="16">Townhouse</option>
<option value="17">House and Lot</option>
<option value="18">Villa</option>
<option value="19">Lot Only</option>
  </select>

  <select id="catId" name="catId" class="valid">
    <option value="20">Select Subcategory</option>
<option value="21">Studio</option>
<option value="22">Apartment</option>
<option value="23">Condominium</option>
<option value="24">Penthouse</option>
<option value="25">Townhouse</option>
<option value="26">House and Lot</option>
<option value="27">Villa</option>
  </select>

    <select id="catId" name="catId" class="valid">
    <option value="28">Select Subcategory</option>
    <option value="29">Pension House</option>
    <option value="30">Inn / Motel</option>
    <option value="31">Hotel &amp; Resort</option>
  </select>

  <select id="catId" name="catId" class="valid">
    <option value="32">Select Subcategory</option>
<option value="33">Space</option>
<option value="34">Office</option>
    <option value="35">BPO</option>
<option value="36">Economic</option>
  </select>

  <select id="catId" name="catId" class="valid">
    <option value="37">Select Subcategory</option>
<option value="38">Warehouse</option>
    <option value="39">Industrial Land</option>
<option value="40">Agriculture Land</option>
  </select>
           
  <select id="catId" name="catId" class="valid">
    <option value="42">Select Subcategory</option>
<option value="43">Building</option>
<option value="44">Beach &amp; Resort</option>
  </select>

Rhoda

  • Jr. Member
  • **
  • Posts: 92
Re: Guys Urgent some help please item post
« Reply #11 on: March 24, 2017, 08:28:23 pm »
Now what i try is to hide a div after you select the category or subcategory!

And this is what i try to hide:

Code: [Select]
<div class="item-post-lot-area">
  <label for="s_lotsize">
    <?php _e('Lot Area''ctg_housing'); ?>
  </label>
  <div class="row collapse prefix-radius">
    <div class="item-post-area-sign columns">
      <span class="prefix"><?php echo osc_get_preference('metric','ctg_housing_theme'); ?></span>
    </div>
    <div class="item-post-area-number columns">
      <input type="number" name="s_lotsize" id="s_lotsize" value="<?php if(isset($housingOut['s_lotsize'])) { echo $housingOut['s_lotsize'];} ?>" >
    </div>
  </div>
</div>

fog

  • Hero Member
  • *****
  • Posts: 1062
Re: Guys Urgent some help please item post
« Reply #12 on: March 24, 2017, 08:28:58 pm »
I cannot follow you with precision.

First: why you not call in your theme the core functions for categories: <?php ItemForm::category_multiple_selects(null, null, __('Select a category', 'name_theme')); ?>

What you need to hide? I know you need hide something div, but not sure what content. Is inside of dropdown menu of categories or outside, with other type of content?

Rhoda

  • Jr. Member
  • **
  • Posts: 92
Re: Guys Urgent some help please item post
« Reply #13 on: March 24, 2017, 08:30:59 pm »
On this categories and or subcategories!

Code: [Select]
  <select id="catId" name="catId" class="valid">
<option value="2">Boarding House</option>
<option value="3">Studio</option>
<option value="4">Apartment</option>
<option value="5">Condominium</option>
<option value="6">Penthouse</option>
  </select>
  <select id="catId" name="catId" class="valid">
    <option value="11">Select Subcategory</option>
<option value="12">Studio</option>
<option value="13">Apartment</option>
<option value="14">Condominium</option>
<option value="15">Penthouse</option>
  </select>
  <select id="catId" name="catId" class="valid">
    <option value="20">Select Subcategory</option>
<option value="21">Studio</option>
<option value="22">Apartment</option>
<option value="23">Condominium</option>
<option value="24">Penthouse</option>
  </select>
<option value="28">Vacation</option>
  <select id="catId" name="catId" class="valid">
    <option value="28">Select Subcategory</option>
    <option value="29">Pension House</option>
    <option value="30">Inn / Motel</option>
    <option value="31">Hotel &amp; Resort</option>
</option>
  </select>
  <select id="catId" name="catId" class="valid">
    <option value="32">Select Subcategory</option>
<option value="33">Space</option>
<option value="34">Office</option>
    <option value="35">BPO</option>
<option value="36">Economic</option>
  </select> 

I think the most easy is by a script adding in the item post

But i don't know how!

thanks

Rhoda

  • Jr. Member
  • **
  • Posts: 92
Re: Guys Urgent some help please item post
« Reply #14 on: March 24, 2017, 08:32:15 pm »
outside the categories bud based on the categories