SafeCracker-Edit-Form and File-Field
Posted: 16 September 2010 04:40 PM   [ Ignore ]
Wallflower
Rank
Total Posts:  5
Joined  2010-08-30

Is there a way to use a SafeCracker-(Edit-)Form (in combination with the SafeCracker File-Field) to edit a entry AND it’s file?

Right now, if I use a SafeCracker-Form with a SafeCracker-File-Field, the file-field is empty (means, it does not contain the URI to the already uploaded field), if I submit the Form without re-selecting the file, the file-field get’s overwritten â?¦Â is there a way to use the form with something like «value=“custom_field_title”» for file-field-inputs? Or how should I else use a SafeCracker-Form to edit an Entry that contains Files?

-stefan

 Signature 

best regards from the swiss alps
-stefan

LOVE SafeCracker! Helps me a lot while developing a EE2 recoding for http://www.macprime.ch

Profile
 
 
Posted: 16 September 2010 05:11 PM   [ Ignore ]   [ # 1 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

Can we see your template code?

Profile
 
 
Posted: 16 September 2010 05:29 PM   [ Ignore ]   [ # 2 ]
Wallflower
Rank
Total Posts:  5
Joined  2010-08-30

sure.

here it is (simplified)

{exp:safecracker channel='downloads-osx' return='admin/downloads/success' entry_id='{segment_4}'}
<fieldset>
    <
h2><label for="title">Name der OS-X-App&nbsp;&nbsp;<em>Nur Nameohne Version o. &Auml;.</em></label></h2>
    <
p><input type="text" id="title" name="title" class="medium" value="{title}" placeholder="z.B. Â«macprime»" /></p>
</
fieldset>
â?¦
<fieldset>
    <
h2><label for="osx-icon">Icon&nbsp;&nbsp;<em>optimal512x512 Pixel</em></label></h2>
    <
p><input type="file" id="osx-icon" name="osx-icon" ></p>
    <
h2><label for="osx-screens">Screenshot</label></h2>
    <
p><input type="file" id="osx-screens" name="osx-screens" ></p>
</
fieldset>
<
class="buttons"><button name="submit" class="gorgeous">OS-X-App {if segment_4 == ''}eröffnen{if:else}aktualisieren{/if}</button></p>
{/exp:safecracker} 
 Signature 

best regards from the swiss alps
-stefan

LOVE SafeCracker! Helps me a lot while developing a EE2 recoding for http://www.macprime.ch

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

The true, supported way is to use the {field:your_field_name} tag. That will print out the file field, and a thumbnail if one exists. It will also print out all the necessary Javascript.

Profile
 
 
Posted: 16 September 2010 06:18 PM   [ Ignore ]   [ # 4 ]
Wallflower
Rank
Total Posts:  5
Joined  2010-08-30

But will {field:your_field_name} not use the standard-ee-field-upload-nightmare where you have all this ***-JavaScript-Form with a dropdown of all (!!!) your upload-dirs etc.? â?¦Â that’s not really user-friendly â?¦Â and what about SafeCracker-Field (the KISS-file-upload-solution). hmmm

 Signature 

best regards from the swiss alps
-stefan

LOVE SafeCracker! Helps me a lot while developing a EE2 recoding for http://www.macprime.ch

Profile
 
 
Posted: 16 September 2010 06:19 PM   [ Ignore ]   [ # 5 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

No, no, it’s not the full file manager. Take a look at your channel in the CP. You can see what the field output looks like there. It’s just a file form input and a thumbnail, and a remove upload button. Really slick.

Profile
 
 
Posted: 16 September 2010 06:23 PM   [ Ignore ]   [ # 6 ]
Wallflower
Rank
Total Posts:  5
Joined  2010-08-30

wohooo! Sorry, my bad! Didn’t changed the field-type on my quick-and-dirty example form from «(EE)File» to «SafeCracker File»!

YEAH! Thx, Rob! Once again: I LOVE SafeCracker! :-D

 Signature 

best regards from the swiss alps
-stefan

LOVE SafeCracker! Helps me a lot while developing a EE2 recoding for http://www.macprime.ch

Profile