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 form shows first entry relational field, CP form does not

October 28, 2012 6:47am

Subscribe [2]
  • #1 / Oct 28, 2012 6:47am

    atelier2

    181 posts

    I hope I can describe this a bit.

    It occurred after update to the latest version.

    I have three relational fields, they show in the CP as a drop down list, but WITHOUT the first entree choosen. We see just two dashes show in the dropdown. This is good.
    In a Safecracker form they show WITH the first entree already choosen. This is unwanted.
    How could I fix this?

    Thanks!

  • #2 / Oct 30, 2012 3:46am

    atelier2

    181 posts

    Any chance someone could have a look at this? Site was live and functioning, now after update I get questions from my customer…...

  • #3 / Oct 30, 2012 10:49am

    Shane Eckert

    7174 posts

    Hello atelier2,

    I am sorry to hear you are running into this problem.

    Can you please show me the SC code that you are using?

    Thank you,

  • #4 / Oct 30, 2012 12:31pm

    atelier2

    181 posts

    Hi Shane

    The code was the same as before the update.

    {exp:safecracker  channel="chemicals" return="editors/editor/{logged_in_member_id}" url_title="{segment_3}" }
           <label for="title">Produktnaam NL</label>
    
            <input type="text" 
    name="title" id="title" value="{title}" size="50" maxlength="100"><br >
    
    {custom_fields}
        <label for="{field_name}">{if required}* {/if}{field_label}</label>
        
        {if textarea}
            <textarea id="{field_name}" name="{field_name}" dir="{text_direction}" rows="{rows}">{field_data}</textarea><br >
        {/if}
        
        {if text}
            <input type="text" dir="{text_direction}" id="{field_name}" name="{field_name}" value="{field_data}" maxlength="{maxlength}" size="100" /><br >
        {/if}
        
        {if file}
            {display_field}
        {/if}
        
        {if relationship}
            <select id="{field_name}" name="{field_name}">
            {options}<option value="{option_value}"{selected}>{option_name}</option>{/options}
            </select>
    
        {/if}
    
    {if safecracker_file}
                        
                        De afbeelding moet een grootte hebben van 100 x 100 px bij 72 ppi.
    
                       
                        {display_field}
                        
                    
                    {/if}  
        
    {/custom_fields}
            <input type="submit" name="submit" value="Submit" />
    
    {/exp:safecracker}

    Thanks for answering, hope it is a small fix.

  • #5 / Oct 31, 2012 12:35pm

    Shane Eckert

    7174 posts

    Hey Atelier,

    I am bringing your other thread into support. Let’s get this one taken care of as well.

    Cheers,

  • #6 / Nov 05, 2012 2:29pm

    Dan Decker

    7338 posts

    Hello Hans!

    With SafeCracker - I’m sorry the functionality changed between versions, but the quickest way to offer a fix is to add a “blank option” to your form:

    {if relationship}
    <select id="{field_name}" name="{field_name}">
    <option value"">--</option>
    {options}<option value="{option_value}"{selected}>{option_name}</option>{/options}
    </select>
    
    {/if}

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases