The following field is required…
Posted: 09 September 2010 05:09 PM   [ Ignore ]
Wallflower
Rank
Total Posts:  4
Joined  2010-09-08

Hi, I’m a SafeCracker newbie but impressed already. However, on my project I get “The following field is required…” message on submission. All these fields are populated prior to submission so I’m a little confused. My code is as follows:

{exp:safecracker channel="classifieds" 
        
return="classifieds/thanks" 
        
datepicker="no"
    
}
    
<div>
        <
label><em>*</em>Give your item a descriptive title</label>
        <
input type="text" name="title" id="title" value="{title}" maxlength="100">
        <
input type="hidden" name="url_title"  id="url_title" value="{url_title}" maxlength="75" class="required" />
    </
div>
    <
div>
        <
input type="hidden" name="allow_comments" value="n" />
        <
label><em>*</em>Choose a Category</label>
        <
select name="category[]">
            <
option value=""></option>
            
{exp:query sql="SELECT cat_id, group_id, cat_name, cat_order FROM exp_categories WHERE group_id='14' ORDER BY cat_order ASC"}
            
<option value='{cat_id}'>{cat_name}</option>
            
{/exp:query}
        
</select>
    </
div>
    
{custom_fields}
    
<div>
        <
label>{if required}<em>*</em>{/if}{field_label} <span>{field_instructions}</span></label>
        
{if textarea}<textarea id="{field_name}" name="{field_name}" dir="{text_direction}" cols="50" rows="{rows}"{if required} class="required"{/if}>{field_data}</textarea>{/if}        
        {if textinput}
<input type="text" dir="{text_direction}" id="{field_name}" name="{field_name}" value="{field_data}" maxlength="{maxlength}"{if required} class="required"{/if} />{/if}
        {if pulldown}
        
<select id="{field_name}" name="{field_name}"{if required} class="required"{/if}>
        
{options}<option value="{option_value}"{selected}>{option_name}</option>{/options}
        
</select>
        
{/if}
        {if safecracker_file}{display_field}{
/if} 
    
</div>
    
{/custom_fields}
<button name="submit">Submit</button>
    
{/exp:safecracker} 
Profile
 
 
Posted: 09 September 2010 05:19 PM   [ Ignore ]   [ # 1 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

Are there any fieldtypes in that channel that are not accounted for in your custom_fields conditionals? It’s odd that the field label is not showing in the error message. Is there any chance you could give us CP & FTP access? You can PM me.

Profile
 
 
Posted: 09 September 2010 05:43 PM   [ Ignore ]   [ # 2 ]
Wallflower
Rank
Total Posts:  4
Joined  2010-09-08

All field types are accounted for. Can’t really give you access I’m afraid. Interestingly, I made my custom fields non mandatory and the form submitted without errors. However, everything but the entry title was blank in the control panel. Seems like the fields aren’t recognized by SafeCracker or something. Is it worth trying without the {custom_fields}{/custom_fields} conditionals â?? i.e. just hardcoding the fields individually (e.g. <input type=“text” id=“classified_email” name=“classified_email” value=”” maxlength=“128” class=“required” />)?

Profile
 
 
Posted: 09 September 2010 05:45 PM   [ Ignore ]   [ # 3 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

It’s probably worth a shot.

Profile
 
 
Posted: 09 September 2010 07:23 PM   [ Ignore ]   [ # 4 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

Which other addons do you have installed?

Profile
 
 
Posted: 09 September 2010 08:05 PM   [ Ignore ]   [ # 5 ]
Wallflower
Rank
Total Posts:  4
Joined  2010-09-08

Ha! How long have you got? I don’t think there’s any clash there though. All fields in this particular channel are EE/1st party ones. Not much else on this page other than membership stuff ({if logged_in}). Just tried with hard-coded fields and got the error message again :-(.

Profile
 
 
Posted: 09 September 2010 08:10 PM   [ Ignore ]   [ # 6 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

Do you have the both the module & extension enabled?

Profile
 
 
Posted: 09 September 2010 08:16 PM   [ Ignore ]   [ # 7 ]
Wallflower
Rank
Total Posts:  4
Joined  2010-09-08

Yikes! Extension was disabled for some reason. I’m sure I enabled it, but there you go. All sorted now, thanks. Wow, do I feel stupid.

Profile
 
 
Posted: 09 September 2010 08:17 PM   [ Ignore ]   [ # 8 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

It happens to all of us sometimes smile

Profile
 
 
Posted: 09 September 2010 08:18 PM   [ Ignore ]   [ # 9 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

Can I ask you to check one thing for me? If you submit your form with some of those require fields blank, does the error message display the field labels properly?

Profile
 
 
Posted: 09 September 2010 08:26 PM   [ Ignore ]   [ # 10 ]
Wallflower
Rank
Total Posts:  4
Joined  2010-09-08

Yep, all good.

Profile