- Posts: 31
COMMUNITY FORUM
Set certain category 2 post items in,via front-end
- ghandil
- Topic Author
- Offline
- Junior Member
Thank you
Please Log in or Create an account to join the conversation.
- Mohamed Abdelaziz
- Offline
- Platinum Member
- Joomla Developer
Look at the Basic Options in the right pane, Pre-selected category
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Please Log in or Create an account to join the conversation.
- ghandil
- Topic Author
- Offline
- Junior Member
- Posts: 31
Mohamed Abdelaziz wrote: The item edit form menu type of k2 already has this feature,
Look at the Basic Options in the right pane, Pre-selected category
Thanks a lot Mohamed :)
How to hide the category filed? You know it shows all other categories (however disabled) in a drop down field in submission form.
Please Log in or Create an account to join the conversation.
- Mohamed Abdelaziz
- Offline
- Platinum Member
- Joomla Developer
Then edit the itemform.php file at line ~88, to add style="display:none;" to the row categories list, it should be like this:
<tr style="display: none;">
<td class="adminK2LeftCol">
<label><?php echo JText::_('K2_CATEGORY'); ?></label>
</td>
<td class="adminK2RightCol">
<?php echo $this->lists['categories']; ?>
</td>
</tr>
Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store
Please Log in or Create an account to join the conversation.
- ghandil
- Topic Author
- Offline
- Junior Member
- Posts: 31
But this way and similar ways (such HTML commenting <!-- -->) users are still able to show and see hidden categories by set display to normal via browsers' developer tools.
Would you recommend to hide field theme with an always false PHP conditional blocks, like this:
Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
- Posts: 15920
You can use a simple JS script to remove all the other options from that select box.
stackoverflow.com/questions/18866745/remove-all-options-from-select-jquery-but-only-one
Something like this will help you or you can remove all the option that are not preselected
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- ghandil
- Topic Author
- Offline
- Junior Member
- Posts: 31
Krikor Boghossian wrote: That won't work a value has to be selected.
You can use a simple JS script to remove all the other options from that select box.
stackoverflow.com/questions/18866745/remove-all-options-from-select-jquery-but-only-one
Something like this will help you or you can remove all the option that are not preselected
Thanks.
Therefore is there any way to define a value in template overriding files and hide its related field completely? (It's better to be by variable but constant would work too). I would need it to Auto title assignment for item submitted by users
Also to hide some other fields than category field, (such as main content tab and others) it would be helpful, since they need values too methinks? I'm going to hide almost all fields (including Toggle sidebar fields) except ExtraFields
P.s: Sorry for delaying. I had trouble to post reply in this topic for 2 weeks
Regards
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
- Posts: 15920
This way you don't have to remove any code from the itemform file.
Also I suggest you hide the select box using CSS since you have already defined a category and removed all the other options.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- ghandil
- Topic Author
- Offline
- Junior Member
- Posts: 31
Hi Krikor, Merry Christmas :)Krikor Boghossian wrote: You can disable almost all the elements through K2's parameters.
This way you don't have to remove any code from the itemform file.
Also I suggest you hide the select box using CSS since you have already defined a category and removed all the other options.
Thanks for your reply. I really appreciate your help
About disabling elements from K2 parameters, I already disabled all elements except EXtraFields, But content tab and top inputs (Featured, Published,tags, ...) still remain. (I showed them in the attached image)
And as you see in the image, even when the default category is selected in the menu link parameters, users are still forced to select it from drop down input,; even though other categories aren't selectable.
Regards
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
- Posts: 15920
Actually you pretty much don't need any element from K2.
You can predefine a title by editing the
<input class="text_area k2TitleBox" type="text" name="title" id="title" maxlength="250" value="<?php echo $this->row->title; ?>" />
as for all other values I think you should populate the data with a jQuery script and then apply a display: none value.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.