Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter AlamSyed

    (@alamsyed)

    Hello Michael,
    I don’t know how do I integrate the dependent drop down javascript plugin with the cmb2 fields. I am not well versed with web technologies either, I mostly know C++. Can you show me something ? Can you share what you were able to do with the code ? We can build it into a proper field and release it to the community ?

    Alam

    Thread Starter AlamSyed

    (@alamsyed)

    Here is the simple HTML javascript code to accomplish the above functionality.

    <!-- Select Basic Independent-->
    			<div class="form-group">
    				<label class="col-md-4 control-label" for="selectbasic">Select Field</label>
    				<div class="col-md-3">
    					<select id="select-field-id" class="form-control"
    						name="select-field" required="">
    						<option id="">Select...</option>
    					</select>
    				</div>
    			</div>
    			<!-- Select Basic Independent-->
    			<div class="form-group">
    				<label class="col-md-4 control-label" for="selectbasic">Select Area</label>
    				<div class="col-md-3">
    					<select id="select-area-id" class="form-control" name="select-area"
    						required="">
    						<option id="">Select...</option>
    					</select>
    				</div>
    			</div>
    
    			<!-- Select Basic (Parent)-->
    			<div class="form-group">
    				<label class="col-md-4 control-label" for="selectbasic">Select Type</label>
    				<div class="col-md-3">
    					<select id="select-type-id" class="form-control" name="select-type"
    						required="">
    						<option id="">Select...</option>
    					</select>
    				</div>
    			</div>
    			<!-- Select Basic (Child #1)-->
    			<div class="form-group">
    				<label class="col-md-4 control-label" for="selectbasic">Select
    					Organization</label>
    				<div class="col-md-3">
    					<select id="select-org-id" class="form-control" name="select-org"
    						required="">
    						<option id="">Select...</option>
    					</select>
    				</div>
    			</div>
    			<!-- Select Basic (Child #2)-->
    			<div class="form-group">
    				<label class="col-md-4 control-label" for="selectbasic">Select
    					Publication</label>
    				<div class="col-md-6">
    					<select id="select-publication-id" class="form-control"
    						name="select-publication" required="">
    						<option id="">Select...</option>
    					</select>
    				</div>
    			</div>
    
    			<!-- Javascript call on document ready -->
    			<script>
    
    			$(document).ready(function(){
    
    				// console.log("my registration template document loaded with dependent drop downs");  // Debug only feature
    
    				// Parent
    				$("#select-field-id").depdrop({
    					url : '<?php echo manage_posts_helper::getRelativePathToActionScripts() . '/templates/get-fields.php' ?>',
    					depends : ['projectname']
    				});
    
    				// Child # 1
    
    				$("#select-area-id").depdrop({
    
    					url : '<?php echo manage_posts_helper::getRelativePathToActionScripts() . '/templates/get-areas.php' ?>',
    
    					depends : ['select-field-id']
    
    				});
    
    				// Child # 2
    
    				$("#select-type-id").depdrop({
    
    					url : '<?php echo manage_posts_helper::getRelativePathToActionScripts() . '/templates/get-types.php' ?>',
    
    					depends : ['select-field-id','select-area-id']
    
    				});
    
    				// Child # 3
    
    				$("#select-org-id").depdrop({
    
    					url : '<?php echo manage_posts_helper::getRelativePathToActionScripts() . '/templates/get-organizations.php' ?>',
    
    					depends : ['select-field-id','select-area-id','select-type-id']
    
    				});
    
    				// Child # 4
    
    				$("#select-publication-id").depdrop({
    
    					url : '<?php echo manage_posts_helper::getRelativePathToActionScripts() . '/templates/get-publications.php' ?>',
    
    					depends : ['select-field-id','select-area-id','select-type-id', 'select-org-id']
    
    				});
    		</script>

    Thread Starter AlamSyed

    (@alamsyed)

    Hello Michael,
    I can create the said functionality using simple html form with fields from the Jquery plugin : https://github.com/kartik-v/dependent-dropdown. I can also show you the code of how I fetch the parent and children of my wordpress and they work well. But I wish to create forms and fields now with cmb2 after realizing its usefulness.
    Also there is something like cmb2 plugin : https://github.com/jcchavezs/cmb2-conditionals for conditional logic. I don’t know much about using it, since I couldn’t make it work properly.

    Can we make custom fields with dependencies, can you guide me as how can I go about making it work with cmb2 ? Then we may also release it for the community as a new special field.

    Thanks
    Alam

    Thread Starter AlamSyed

    (@alamsyed)

    Ok. But I do not know how to make a bbpress taxonomy from private to public. Anyways thanks for the clarification.

    Thread Starter AlamSyed

    (@alamsyed)

    Thanks I think this is clear now 🙂

    Thread Starter AlamSyed

    (@alamsyed)

    Also when I am logged in as a user. My Articles tab in my buddypress profile does not shows up. It shows up when I am logged in as administrator. Is there a way to enable it for all members for my website ?

    Thanks in advance.

Viewing 6 replies - 1 through 6 (of 6 total)