ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Requiring a custom field image uploaded before weblog submission

February 29, 2012 9:27am

Subscribe [2]
  • #1 / Feb 29, 2012 9:27am

    visualpeace

    8 posts

    Hi all my background isn’t coding so I need some help here.  Below is a form for users to create a weblog photo gallery.  I want to require them to upload a cover image before they click submit.  I tried various things and search the web for help but couldn’t find anything that worked.  {cover_img} is a custom weblog field and the field type is “nGen File Field” .  That is what I want to be required.  When editing the cover_img custom field there is an option “Is this a required field?” which I clicked yes on but nothing changed.


    Can somebody help me? 

    {exp:weblog:entry_form weblog="galleries" show_fields="not ps_photos|cover_img|gallery_photo_unlimited|gallery_photo_standard|gallery_photo_free|gallery_photo_guild" status="open"} 
    <input type="hidden" name="entry_id_return" value="/galleries/entry/%%entry_id%%" />
    <input type="hidden" name="status" value="open" />
    
    <div class="ff-ft">
    <h4>Your Gallery Title</h4>
    <p><input type="text" name="title" id="title" value="{title}" maxlength="100" class="input" /></p><br />
    </div></p>
    
    <p> </p>
    
    <p><div class="ff-ft"></p><h4>Upload Your Cover Image</h4>
    <p>{cover_txt}<br />
    {cover_img}<br />
    </div></p>
    
    <p> </p>
    
    <p><div class="ff-ft"></p><h4>Add Your Photos</h4>
    <p>Photo Size: <strong>640 x  427</strong>.  Add your gallery here. <br />
     With your Free membership, you can upload 10 images.  To arrange PHOTO ORDER, click and drag the corresponding number.<br />
    {gallery_photo_free}<br />
    </div></p>
    
    <p> </p>
    
    <p>{custom_fields}<br />
    <div class="ff-ft"><br />
    {if required}* {/if}</p><h4>{field_label}</h4>
    <p>{field_instructions}<br />
    {if textarea}<br />
    <textarea id="{field_name}" name="{field_name}"  class="input" dir="{text_direction}">{field_data}</textarea></div> <br />
    {/if}</p>
    
    <p>{if textinput}<br />
    <input type="text" dir="{text_direction}" id="{field_name}" class="input" name="{field_name}" value="{field_data}" maxlength="{maxlength}" /></div> <br />
    {/if}</p>
    
    <p>{if pulldown}<br />
    <select id="{field_name}" name="{field_name}"><br />
    {options}<option value="{option_value}"{selected}>{option_name}</option>{/options}</p>
    
    <p></select></div> <br />
    {/if}</p>
    
    <p>{if date}<input type="text" id="{field_name}" name="{field_name}" value="{field_data}" maxlength="{maxlength}" class="input"/></div> <br />
    {/if}<br />
    {/custom_fields} </p>
    
    <p><input type="image" src="/assets/submit-btn.gif" name="submit" value="Submit" class="ro"/></p><br />
    {/exp:weblog:entry_form}

  • #2 / Mar 01, 2012 10:39am

    Shane Eckert

    7174 posts

    Hello visualpeace,

    I am sorry to hear you are running into this snag with a required field.

    The form is fully functional aside from the required field, correct? Your concern is that you have checked that the field be required, but it is letting you submit the form even though an image was not uploaded.

    Are you using Matrix by chance? I stumbled upon this article and it looks like this should work, but not with Matrix.

    Are you using any other Add-Ons?

    Let me know what you find and we will go from there.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases