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 input questions...

July 31, 2011 4:23pm

Subscribe [5]
  • #1 / Jul 31, 2011 4:23pm

    hellodanny

    52 posts

    Hi,

    Im using safecracker but im having issues with a textarea input and an image upload

    My template contains the following

    {exp:safecracker channel="lost" return="lostentry/thank-you" entry_id="{segment_3}"}
    
        <label for="title">Title</label>
        <input type="text" name="title" id="title" value="{title}" size="50" maxlength="100" /></p>
    
    
    
        <label for="sex">Sex?</label>
        <select name="l_sex" id="l_sex">
        {options:l_sex}
            <option value="{option_value}"{selected}>{option_name}</option>
        {/options:l_sex}
        </select>
    
    
    <label for="age">Age (if known)</label>
        <input type="text" name="l_age" id="l_age" value="{l_age}" maxlength="75" size="50" /></p>
        
        <label for="age">Breed (if known)</label>
        <input type="text" name="l_breed" id="l_breed" value="{l_breed}" maxlength="75" size="50" /></p>
        
    
        
        <label for="type">type of animal</label><select name="l_type" id="l_type">
        {options:l_type}
            <option value="{option_value}"{selected}>{option_name}</option>
        {/options:l_type}
    
        </select>
        
        <label for="image">Image</label>
    <input type="file" name="{l_image}" id="image" value="{l_image}" /></p>
        
    
        
             {custom_fields}
    
                        {if textarea}
                            <label for="description">Description</label>
    
                               <textarea id="{l_description}" name="{l_description}" rows="10" cols="50">{l_description}</textarea>
                        {/if}
                     {/custom_fields}
        
        
    
    <label for="name">Your Name</label>
        <input type="text" name="l_name" id="l_name" value="{l_name}" maxlength="75" size="50" /></p>
        
        <label for="phone">Your Phone</label>
        <input type="text" name="l_phone" id="l_phone" value="{l_phone}" maxlength="75" size="50" /></p>
        
        <label for="email">Your Email</label>
        <input type="text" name="l_email" id="l_email" value="{l_email}" maxlength="75" size="50" /></p>
        
        
        
        {if captcha}
            <label for="captcha">Please enter the word you see in the image below:</label>
            {captcha}
    
            <input type="text" name="captcha" value="{captcha_word}" maxlength="20" />
        {/if}
    
        <input type="submit" name="submit" value="Submit" />
    
    {/exp:safecracker}

    ok, all field except the textarea and the image upload are saving data as needed. I have changed the file field on the associated custom field to safecracker file but im not having any luck… 

    can someone point me in the right direction? Ive searched the forums but cant find anything that fixes this (yet)

    Another question is, using fieldtype SafeCracker File removes the ability for me to edit the image uploaded… is there a way around this?

  • #2 / Aug 01, 2011 11:34am

    hellodanny

    52 posts

    ok this seems to be wrong   {custom_fields}

  • #3 / Aug 01, 2011 12:27pm

    Sue Crocker

    26054 posts

    DanielQ, this is what I use for SafeCracker. I have two fields, one textarea and one SC file field.

    <div>
    <label for="sc_textarea"><strong>SC Textarea</strong></label>
        
    {field:sc_textarea}
    </div>
    
    
    <div>
    <label for="sc_file"><strong>SC File</strong></label>
        
    {field:sc_file}
    </div>

    For simplicity sake I use sc_textarea and sc_file for the two field names.

    I can replicate the problem of not being able to remove the SC file image, you have to do so inside the control panel. You didn’t mention which version of EE you’re using: Can you tell us which version/build of EE2.x you’re using? See EEWiki:// HowTo Determine My EE Version

  • #4 / Aug 01, 2011 2:10pm

    hellodanny

    52 posts

    Hi Sue,

    Ive tried the code you mention and i now get an error

    An Error Was Encountered
    
    In order to use the encryption class requires that you set an encryption key in your config file.

    ee version is 2.1.3
    safecracker is 2.0.0

  • #5 / Aug 01, 2011 2:32pm

    Sue Crocker

    26054 posts

  • #6 / Aug 01, 2011 4:50pm

    hellodanny

    52 posts

    Hi Sue,

    Ok, no error this time however the image is not uploaded, a reference to the directory and filename is created however the image is not created/present

  • #7 / Aug 01, 2011 5:44pm

    Sue Crocker

    26054 posts

    EE 2.2.2 was just updated.. can we have you upgrade?

  • #8 / Aug 02, 2011 7:49am

    hellodanny

    52 posts

    Hi Sue,

    I have updated but receive the following error when trying to edit any existing content

    Fatal error: Cannot redeclare class File_ft in /home/vpshook/public_html/myadmin/expressionengine/fieldtypes/ft.file.php on line 314

  • #9 / Aug 02, 2011 10:20am

    hellodanny

    52 posts

    what can i do with this error?

  • #10 / Aug 02, 2011 12:32pm

    hellodanny

    52 posts

    Im under pressure in my office, i want to avoid rolling back… any ideas whats up?

  • #11 / Aug 02, 2011 1:14pm

    Sue Crocker

    26054 posts

    Let’s have you look at your fieldtypes. Can you get a screen shot of it?

  • #12 / Aug 02, 2011 2:30pm

    hellodanny

    52 posts

    i have lost the ability to create custom fields…

  • #13 / Aug 03, 2011 3:25am

    hellodanny

    52 posts

    ok ive rolled back for now. would appreciate any input re errors.

    Also ive found that images ARE being uploaded however it is to the wrong location, that being /system
    so the files exist - but in the wrong place

  • #14 / Aug 03, 2011 5:27am

    John Henry Donovan

    12339 posts

    DanielQ,

    Regarding your the ability to create custom fields…
    In your screenshot. Nothing seems out of place. You would see your custom field groups after clicking on Admin -> Channel Fields. What happens if you click on the Channel Fields link?

    Do you get an error of some sorts?

    You can view the fieldtypes you have installed by goign to Add-ons -> Fieldtypes

    Regarding SC to clear up a custom field. You either have this

    {custom_fields}
    <label for="{field_name}">{if required}* {/if}{field_label}</label>
    
    {field_instructions}
    
    {formatting_buttons}
    
    {if error} {error} {/if}
    
    {if textarea}
    <textarea id="{field_name}" name="{field_name}" dir="{text_direction}" rows="{rows}">{field_data}</textarea> 
    {/if}
    
    {if safecracker_file} {display_field} {/if}
    {/custom_fields}

    or this

    <div>
    <label for="description"><strong>Description</strong></label>
        
    {field:l_description}
    </div>
    
    
    <div>
    <label for="image"><strong>Image</strong></label>
        
    {field:l_image}
    </div>

    You don’t add any custom field names to the custom_field loop itself. It will pick them up itself

    Are you including a link to jquery yourself in the page header?
    Are you adding the SafeCracker CSS to your page header?

    <link href="{path=css/_ee_saef_css}" type="text/css" rel="stylesheet" media="screen" />


    Can you also double check that you have the correct paths in your Upload location setting. Make sure it is a full path

  • #15 / Aug 03, 2011 5:31am

    hellodanny

    52 posts

    ok ive got my site upgrade working (after a lot of noodle scratching)

    My Problem seems to have been with safecracker. I removed it from my old version but the fieldtypes folder remained with individual files so i deleted and ran the upgrade process again. My problem is similar to what was happening here blank page/Jules van Schaijik

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

ExpressionEngine News!

#eecms, #events, #releases