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.

SafeCracker Multipage Forms with required fields

April 03, 2012 11:16am

Subscribe [2]
  • #1 / Apr 03, 2012 11:16am

    Mike_Mc

    33 posts

    I am working on a large safecracker multipage form, its 8 pages.

    I have the paging operating the way I expect it to work, however when I set fields as required, it expects all of the fields to be filled out before I can submit the current page entry data to move to the next. 

    Is there a way that I can validate the required fields on one page of the multipage safecracker form while ignore the remaining future paged fields?

    Here is an example of my relevant paging code…

    {if segment_4=="page1"}
            <h3>Page 1</h3>
    <p>            {exp:safecracker channel="jobs" return="jobs/application/page2/ENTRY_ID" entry_id="{segment_5}"  preserve_checkboxes="yes"}<br />
                 {embed="jobs/.steps"}<br />
                <br />
                    <label for="title">Title</label><br />
                    <input type="" name="title" id="entry-title" value="{if title}{title}{if:else}{logged_in_screen_name}{/if}"  maxlength="75" size="50"><br />
                    <br />
                    <input type="hidden" name="url_title" id="url_title" value="{url_title}" maxlength="75" size="50"><br />
                    </p>
    
    <p>                <label for="position_applying_for">Position Applying For</label><br />
                    {field:position_applying_for}<br />
     <br />
                    <input type="submit" name="submit" value="Next Page"><br />
                {/exp:safecracker}<br />
            {/if}<br />
            <br />
            {if segment_4=="page2"}<br />
            </p><h3>page 2</h3>
    <p>            {exp:safecracker channel="jobs" return="jobs/application/page3/ENTRY_ID" entry_id="{segment_4}" author_only="yes" preserve_checkboxes="yes"}<br />
                 {embed="jobs/.steps"}<br />
                    </p>
    
    <p>    <br />
                 <label for="microsoft_word">Microsoft Word</label>{field:microsoft_word}</p>
    
    <p>                <label for="microsoft_excel">Microsoft Excel</label>{field:microsoft_excel}</p>
    
    <p>                <label for="microsoft_powerpoint">Microsoft PowerPoint</label>{field:microsoft_powerpoint}</p>
    
    <p>                <label for="microsoft_publisher">Microsoft Publisher</label>{field:microsoft_publisher}</p>
    
    <p>                <label for="microsoft_outlook">Microsoft Outlook</label>{field:microsoft_outlook}</p>
    
    <p>                <label for="the_internet">The Internet</label>{field:the_internet}</p>
    
    <p>            <br />
                    <input type="submit" name="submit" value="Next Page"><br />
                {/exp:safecracker}<br />
            {/if}

    Thanks in advance for any input.

  • #2 / Apr 03, 2012 2:08pm

    Mike_Mc

    33 posts

    I found a work around for this, rather than make the fields required when creating them from the control panel use the rules parameter to validate the fields on a per page basis.

    rules:position_applying_for="required"
  • #3 / Apr 04, 2012 11:56am

    Dan Decker

    7338 posts

    Hi Mike,

    Excellent work around!

    Is there anything else I can assist you with?

    Cheers,

  • #4 / Apr 05, 2012 11:03am

    Mike_Mc

    33 posts

    Not as of now, Thanks.  (I posted the “fix” so it could be searched for by some other lost soul.)

    Have a great day!

  • #5 / Apr 06, 2012 3:36pm

    Shane Eckert

    7174 posts

    Hey Mike_Mc,

    That’s pretty awesome of you. Thanks!

    Have a great weekend!!

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases