0

I am trying to allow for tags being added to an entry submitted via a channel form, but right now submissions end in an error message about the Language field being required (that's the tag field) even though I did enter a tag.

I am also wondering if it is possible to strip out the "suggest tags" and "top tags" buttons from the way the tag input appears in a channel form when using "{field:tag_fieldtype_name}"?

The form looks like this:

{exp:channel:form channel="channel9" return="Links" class="Submit" id="Submit"}
    <label for="title">Title</label>
    <input type="text" name="title" id="title" value="{title}" size="50" maxlength="100" onkeyup="liveUrlTitle();" />

    {custom_fields}
        <label for="{field_name}">{field_label}</label>
        {if textarea}
            <textarea id="{field_name}" name="{field_name}" dir="{text_direction}" cols="50" rows="{rows}" onclick="setFieldName(this.name)">{field_data}</textarea>
        {/if}
        {if textinput}
            <input type="text" dir="{text_direction}" id="{field_name}" name="{field_name}" value="{field_data}" maxlength="{maxlength}" size="50" onclick="setFieldName(this.name)" />
        {/if}
    {/custom_fields}

    {field:9_language}  

    {category_menu}
        <label for="categories">Categories</label>
        <select name="category[]" id="categories" size="4">
            {select_options}
        </select>
    {/category_menu}

    {if captcha}
        <br />
        <label for="captcha">Please enter the word you see in the image below:</label>
        <br />
        {captcha}
        <br /><br />
        <input type="text" name="captcha" value="{captcha_word}" maxlength="20">
    {/if}

    <br />
    <input type="submit" name="submit" value="Submit" />
{/exp:channel:form}

The generated html looks like this:

<h3>Submission Form</h3>

<form id="Submit" class="Submit" method="post" action="http://www.westeros.org/Links/Submit"  enctype="multipart/form-data" >
<div class='hiddenFields'>
<input type="hidden" name="RET" value="http://www.westeros.org/Links/Submit" />
<input type="hidden" name="URI" value="Links/Submit" />
<input type="hidden" name="return_url" value="Links" />
<input type="hidden" name="author_id" value="1" />
<input type="hidden" name="channel_id" value="9" />
<input type="hidden" name="entry_id" value="0" />
<input type="hidden" name="ACT" value="19" />
<input type="hidden" name="meta" value="UjJTawVjV2QEOQ51BCIAPABpA28BL1YmVSVVag5mAXYPdQI4UzFSOAU0AzsDLwd6AXVbYVQ3VGhcIg8rVz5UIg19V3YKaVF3XT4IelZvUzZSaVNzBR5XPgRtDmUEIgAkAGcDJgE3VmNValUkDmABbQ82Am1TPlJnBWgDIwNvB3QBPFtjVDtUcFxjDzFXOlQ4DWZXYQprUWxdJwgyViZTOVJmU2sFcFc0BG8ObwQiAHUAfgNuAX5WblVmVTwOIQFWDyICYVM9UmsFcAMjA28HdAE8W2lUO1RwXGkPPVd5VG0Ne1c+CjFRb10nCFpWIFNhUj5TOAUmV3UEOA59BGsANwBvA28BL1YnVTVVZQ52AXcPMgJcUyJSZwVwA3QDJgdpASRbYFRjVGhcMA9iVyhUbA08Vz4KJVE/XXYIZlY7UyFSaFMzBWhXZwQ4Dn0EawA3AG0DbwEvVjVVJVVyDmsBag8lAlxTP1JsBWgDeAN2BzwBZFthVDFUaVxzD2NXalRlDTJXJgp1UTBddAh8VjxTcVI2Uw4FN1c5BHcOfAQoACQAZwM3ATdWZFVrVXUOOQEyD20CIVMjUmsFcANkAwsHbgFiW3lUOlQhXDoPaFdhVHQNOVcmCjxRJl0/CDhWZVM5UnFTMgU6VzYEbQ5gBDQAagADAzwBaVZ2VWtVdQ45ATQPbQIhU2lSIAU/A3IDbgc2ATVbYVQjVDZcZQ86VylULw14V3AKWFE2XW0IbFY2U2hScVNqBTBXbQQyDjUEIgA8AG0DYQE3VnZVMVVqDm8Bag8gAlxTM1JtBWkDbAMxB2kBclsoVCNUaVxzD2NXalRsDSpXagolUW5deA==" />
<input type="hidden" name="return" value="Links" />
<input type="hidden" name="site_id" value="1" />
<input type="hidden" name="csrf_token" value="91d57eea93d5db7b27df4e73b48072e4f2d8edad" />
</div>

<label for="title">Title</label>
<input type="text" name="title" id="title" value="" size="50" maxlength="100" onkeyup="liveUrlTitle();" />
<label for="9_url">URL</label>


<input type="text" dir="ltr" id="9_url" name="9_url" value="" maxlength="100" size="50" onclick="setFieldName(this.name)" /><label for="9_description">Description</label>

<textarea id="9_description" name="9_description" dir="ltr" cols="50" rows="10" onclick="setFieldName(this.name)"></textarea><label for="9_language">Language</label>
<script type="text/javascript" src="http://www.westeros.org/Scripts/ExpressionEngine/themes/third_party/tag/js/jquery.tag_autocomplete.min.js"></script>
<link rel="stylesheet" type="text/css" media="screen" charset="utf-8" href="http://www.westeros.org/Scripts/ExpressionEngine/themes/third_party/tag/css/tag.css" />
<script type="text/javascript" src="http://www.westeros.org/Scripts/ExpressionEngine/themes/third_party/tag/js/tag.js"></script>
<link rel="stylesheet" type="text/css" media="screen" charset="utf-8" href="http://www.westeros.org/Scripts/ExpressionEngine/themes/third_party/tag/css/front_base.css" />
<!--[if IE 8]><div class="solspace_tag_group ie8" id="solspace_tag_field_206"><![endif]-->
<!--[if IE 9]><div class="solspace_tag_group ie9" id="solspace_tag_field_206"><![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<div class="solspace_tag_group" id="solspace_tag_field_206">
<!--<![endif]-->
    <textarea style="display:none;" id="solspace_tag_ta_206"
              name="9_language"></textarea>

    <div class="solspace_tag_new_tags">
        <div class="tag_section_name">
            <div class="staticwrap">
                <span class="add"></span>
                Add&nbsp;Tags           </div>
        </div>
        <div class="tag_section_data">
                <div class="solspace_tag_input_area">
                <div class="tag_error_dialog">
                    <span class="notice">Error text</span>
                </div>
                <input type="text" name="tag_input" value="" class="tag_input"/>
                            <div class="suggest_tags white_grad">
                    <span class="glass"></span>
                    <span class="tag_button_label">Suggest&nbsp;Tags</span>
                </div>
                <div class="top_tags white_grad">
                    <span class="star"></span>
                    <span class="tag_button_label">Top&nbsp;Tags</span>
                </div>
                        </div>
            <div class="tag_clear"></div>
            <div class="solspace_tag_current_tags">
                                <div class="tag_clear"></div>
            </div>
        </div>
        <div class="tag_clear"></div>
    </div>
    <div class="solspace_tag_suggest_tags">
        <span class="tag_section_closer ex"></span>
        <div class="tag_section_name">
            <div class="staticwrap">
                <span class="glass"></span>
                Suggest&nbsp;Tags           </div>
        </div>
        <div class="tag_section_data">
            <div class="refresh_suggest_tags white_grad">
                <span class="refresh"></span>
                <span class="loading"></span>
            </div>
            <div class="tag_clear"></div>
        </div>
        <div class="tag_clear"></div>
    </div>

    <div class="solspace_tag_top_tags">
        <span class="tag_section_closer ex"></span>
        <div class="tag_section_name">
            <div class="staticwrap">
                <span class="star"></span>
                Top&nbsp;Tags           </div>
        </div>
        <div class="tag_section_data">
                            <div class="top_tag white_grad" data-tag="S2">
                    <span class="tag_count">762</span>
                    <span class="plus"></span>
                    <span class="tag_name">S2</span>
                </div>
                            <div class="top_tag white_grad" data-tag="Previews">
                    <span class="tag_count">686</span>
                    <span class="plus"></span>
                    <span class="tag_name">Previews</span>
                </div>
                            <div class="top_tag white_grad" data-tag="Game of Thrones">
                    <span class="tag_count">526</span>
                    <span class="plus"></span>
                    <span class="tag_name">Game of Thrones</span>
                </div>
                            <div class="top_tag white_grad" data-tag="WorldCon">
                    <span class="tag_count">485</span>
                    <span class="plus"></span>
                    <span class="tag_name">WorldCon</span>
                </div>
                            <div class="top_tag white_grad" data-tag="Season 3">
                    <span class="tag_count">459</span>
                    <span class="plus"></span>
                    <span class="tag_name">Season 3</span>
                </div>
                        <div class="tag_clear"></div>
        </div>
        <div class="tag_clear"></div>
    </div>
</div>
<script type="text/javascript">
    (function(global){

        //defaults and tag sets for the external JS
        var data = global.solspaceTag           = global.solspaceTag || {};

        //global items (ok to overwrite)

        //secureFormHash
        data.secureFormHash                     = '91d57eea93d5db7b27df4e73b48072e4f2d8edad';
        //this might be localized to fields later
        data.tagLimit                           = '0';

        data.langItems                          = {
            'error'                     : "Error",
            'tag_limit_reached'         : "Tag Limit of %num% reached.",
            'explode_separator_desc'    : "Error"
        };

        data.tabName                            = '';
        data.delimiters                         = {"colon":":","comma":",","doublepipe":"||","newline":"\n","pipe":"|","semicolon":";","space":" ","tab":"\t","tilde":"~"};

        //per field items

        //current tags
        data['currentTags']                     = data['currentTags'] || {};
        data['currentTags']['206']  = [];
        //top tags
        data['topTags']                         = data['topTags'] || {};
        data['topTags']['206']      = ['S2','Previews','Game of Thrones','WorldCon','Season 3'];
        //all open
        data['allOpen']                         = data['allOpen'] || {};
        data['allOpen']['206']      = 'no';
        //xids
        data['xids']                            = data['xids'] || {};
        data['xids']['206']         = '91d57eea93d5db7b27df4e73b48072e4f2d8edad';
        //auto complete
        data['autocompleteURL']                 = data['autocompleteURL'] || {};
        data['autocompleteURL']['206']= 'http://www.westeros.org/?ACT=59&method=tag_autocomplete&tag_separator=doublepipe&tag_group_id=1';
        //suggest tags
        data['suggestTagsURL']                  = data['suggestTagsURL'] || {};
        data['suggestTagsURL']['206']= 'http://www.westeros.org/?ACT=59&method=tag_suggest&tag_separator=doublepipe&tag_group_id=1';
        //suggest fields
        data['suggestFields']                   = data['suggestFields'] || {};
        data['suggestFields']['206'] = [];
        //EXPLOOOOOOODDDEE!
        data['explodeSeparator']                = data['explodeSeparator'] || {};
        data['explodeSeparator']['206'] = false;
        //separator
        data['separator']                       = data['separator'] || {};
        data['separator']['206']        = '\n';

        //if people load these via ajax, we need to set the events
        if (typeof  global.solspaceTag.domReadyFired !== 'undefined' &&
                    global.solspaceTag.domReadyFired == true)
        {
            global.solspaceTag.setFieldEvents("#solspace_tag_field_206");
        }
    })(window);
</script>

<label for="categories">Category</label>
<select name="category[]" id="categories" size="4">
<option value='170'>A Song of Ice and Fire Fan Sites</option>

<option value='174'>Fan Artists</option>

<option value='209'>Game of Thrones Fan Sites</option>

<option value='171'>George R.R. Martin Fan Sites</option>

<option value='221'>Official Sites</option>

<option value='172'>Professional Artists</option>

</select>


<br />
<input type="submit" name="submit" value="Submit" /></form><script type="text/javascript" charset="utf-8">// <![CDATA[ 
if (typeof EE == "undefined" || ! EE) { 
var EE = {"publish":{"title_focus":true,"smileys":true,"url_title_prefix":"","default_entry_title":""},"user_id":1,"lang":{"confirm_exit":"When you leave, any data entered will be lost. Are you sure you want to leave?","add_new_html_button":"Add New HTML button"},"XID":"91d57eea93d5db7b27df4e73b48072e4f2d8edad","CSRF_TOKEN":"91d57eea93d5db7b27df4e73b48072e4f2d8edad"};}
EE.grid_cache = [];

window.Grid = {
    bind: function() {
        EE.grid_cache.push(arguments);
    }
};mySettings = {"nameSpace":"html","onShiftEnter":{"keepDefault":false,"replaceWith":"<br \/>\n"},"onCtrlEnter":{"keepDefault":false,"openWith":"\n<p>","closeWith":"<\/p>\n"},"markupSet":[{"name":"b","key":"B","openWith":"<strong>","closeWith":"<\/strong>","className":"btn_b"},{"name":"i","key":"I","openWith":"<em>","closeWith":"<\/em>","className":"btn_i"},{"name":"blockquote","key":"Q","openWith":"<blockquote>","closeWith":"<\/blockquote>","className":"btn_blockquote"},{"name":"a","key":"A","openWith":"<a href=\"[![Link:!:http:\/\/]!]\"(!( title=\"[![Title]!]\")!)>","closeWith":"<\/a>","className":"btn_a"}]};

 // ]]>
</script><script type="text/javascript" charset="utf-8" src="http://www.westeros.org/?ACT=52&ui=core,widget,mouse,position,draggable,resizable,button,dialog,datepicker&plugin=markitup,toolbox.expose,overlay,tmpl&file=underscore,cp/date&v=1405860060&use_live_url=y&include_jquery=y"></script>
<script type="text/javascript" charset="utf-8">
// <![CDATA[
$(document).ready(function() {
    var SafeCracker = {}; SafeCracker.markItUpFields = EE.markItUpFields = {};
    $.datepicker.setDefaults({dateFormat:"d-m-y"+EE.date_obj_time});
    $.datepicker.setDefaults({defaultDate: new Date(1422970896000)});
});
// ]]>
</script>
<style type="text/css">.hasDatepicker{background:#fff url(http://www.westeros.org/Scripts/ExpressionEngine/themes/cp_themes/default/images/calendar_bg.gif) no-repeat 98% 2px;background-repeat:no-repeat;background-position:99%;}</style>
2
  • Please post generated HTML to inspect. I suspect you might have duplicate fields in your form. Additionally, inspect browser's javascript console for any errors. – Yuri Salimovskiy Feb 3 '15 at 9:34
  • I added the generated HTML to the main post. I am not familiar with how to use the javascript console - where would I find that on Seamonkey? – Linda Antonsson Feb 3 '15 at 13:46
0

Not sure if 'Allow EE Code' can apply to a channel form but it works for CP side fields... https://devot-ee.com/add-ons/allow-ee-code

0

Please have a look at the Tag documentation for use in the EE Channel Form. The {custom_fields} tag pair might not work: try using the field as in the example in the documentation: {field:tag_fieldtype_name}.

To hide the "suggest tags"/"top tags" sections, you can do so using javascript of (even better) CSS.

1
  • Actually, I am using the second method here: {field:9_language} is the tag field. I tried it with the {custom_fields} pair too, no luck with that either. – Linda Antonsson Feb 1 '15 at 13:36
0

You have this tag fields displayed 2 times: one time inside {custom_fields} pair and another one when you call it by name.

You may filter the first one by changing {if textarea} to

{if textarea AND field_name != "9_language"}

2
  • If I make that change, submitting the form leads to the following message: This form has expired. Please refresh and try again. – Linda Antonsson Feb 4 '15 at 19:52
  • If you did not change anything but that line, then the error is irrelevant and the form is really expired. Please double check. – Yuri Salimovskiy Feb 5 '15 at 6:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.