Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 ANDing multiple values in a field
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #6
RE: ANDing multiple values in a field
I just want to add an idea just by using templates, but we  need multiple checkbox fields with single value. Then modify the templates so it looks like one input.

For example, lets say we have 4 values, A, B, C and D

Option A:
Key: oa
Hide Thread Field: check all.
Input Field Type: Checkboxes
Value List: A
Multiple Value Delimiter: space or whatever
Filtering Mode: Exact match

Option B:
Key: ob
Hide Thread Field: check all.
Input Field Type: Checkboxes
Value List: B
Multiple Value Delimiter: space or whatever
Filtering Mode: Exact match

Option C:
Key: oc
Hide Thread Field: check all.
Input Field Type: Checkboxes
Value List: C
Multiple Value Delimiter: space or whatever
Filtering Mode: Exact match

Option D:
Key: od
Hide Thread Field: check all.
Input Field Type: Checkboxes
Value List: D
Custom Modify Error:
This one forces user to select at least one options.

Code:
<if !$mybb->input['xthreads_oa'] && !$mybb->input['xthreads_ob'] && !$mybb->input['xthreads_oc'] && !$mybb->input['xthreads_od'] then>
Please select at least one Options
</if>

Multiple Value Delimiter: space or whatever
Filtering Mode: Exact match

Insert this code inside the form (for example before {$posticons}) in template_prefix_newthread and template_prefix_editpost_first

HTML Code
<tr>
<td class="trow2" width="20%"><strong>Options</strong></td>
<td class="trow2">{$tfinput['oa']} {$tfinput['ob']} {$tfinput['oc']} {$tfinput['od']}</td>
</tr>


Then for filtering interface, insert this code inside the form in template_prefix_forumdisplay_searchforum_inline (don't forget to activate the Enable XThreads' Inline Forum Search setting:

HTML Code
<input type="checkbox" class="checkbox" name="filtertf_oa" value="A"{$GLOBALS['filters_set']['oa']['checked']['A']}  /> A
<input type="checkbox" class="checkbox" name="filtertf_ob" value="B"{$GLOBALS['filters_set']['ob']['checked']['B']}  /> B
<input type="checkbox" class="checkbox" name="filtertf_oc" value="C"{$GLOBALS['filters_set']['oc']['checked']['C']}  /> C
<input type="checkbox" class="checkbox" name="filtertf_od" value="D"{$GLOBALS['filters_set']['od']['checked']['D']}  /> D



Attached File(s) Thumbnail(s)
       

09-25-2015 05:56 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
ANDing multiple values in a field - ln_e - 09-23-2015, 11:45 PM
RE: ANDing multiple values in a field - RateU - 09-25-2015 05:56 AM

 Standard Tools
Forum Jump: