Embed Safecracker Problem?
Posted: 14 January 2011 03:36 AM   [ Ignore ]
Wallflower
Rank
Total Posts:  4
Joined  2010-12-04

I have a template where I embed the safecracker form and pass into the embedded template variables which are used to fill in the value fields.  Most of the fields are hidden, I only want the user to see a very small number of fields.  I set the rest from channel entries and JavaScript.  I look at it in firebug and the form looks good, all fields are set as expected.  If I submit the form the data in the value fields does not get into the entry (the title, url_title and date fields look good). Not even the comment field got filled in and it was not hidden.  If I don’t set each custom field as “not required” I get a form submission error.

{exp:safecracker channel="trades" return="site/trade/review/{embed:img_req}"}
 
<input type="hidden" name="title" id="title" value="Trade Request {segment_4}/{member_id}" size="50" maxlength="100"/> 
 <
input type="hidden" name="url_title" id="url_title" value="trade_request_{segment_4}/{member_id}" maxlength="75" size="50" />
 <
input type="hidden" name="entry_date" id="entry_date" value="{entry_date}"/> 
 <
input type="hidden" name="trade_req_member_id" id="trade_req_member_id" value="{embed:req_member_id}" /> 
 <
input type="hidden" name="trade_rsp_member_id" id="trade_rcp_member_id" value="{embed:rcp_member_id}" />
 <
input type="hidden" name="trade_image_req" id="trade_image_req" value="{embed:img_req}" /> 
 <
textarea name="trade_req_comment" id="trade_req_comment" dir="{text_direction}" rows="{rows}"></textarea
 <
input type="submit" name="submit" value="Submit" /> 
 
{/exp:safecracker} 


To test this problem I pulled the form out of the embedded template and put it directly into the main template and tried again.  It worked as expected. 

  I am guessing this is some sort of template parsing order issue (maybe)?

Profile
 
 
Posted: 14 January 2011 04:27 AM   [ Ignore ]   [ # 1 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

It sure sounds like a parse order issue if it works outside the embed. It might also be some kind of malformed HTML or something. Can you inspect the POST data it sends out? I think you can do that in Firebug. There are some other Firefox plugins for that too, like Tamperdata or httpfox.

Profile
 
 
Posted: 14 January 2011 07:32 AM   [ Ignore ]   [ # 2 ]
Wallflower
Rank
Total Posts:  4
Joined  2010-12-04

Its working now.  Could it have had something to do with permissions.  While waiting for you to answer I noticed my member did not have permission to publish to the trades channel.  Would that allow the channel add to occur but without any data being posted to the custom field entries??

Profile
 
 
Posted: 14 January 2011 08:37 AM   [ Ignore ]   [ # 3 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

No, I’ve never seen that before. Quite strange.

Profile