1

So I have a safecracker form that presents different fields to different users. Think admin controls vs user controls in the same form.

{exp:safecracker channel="channelName" url_title="{segment_1}" return="/{segment_1}" include_jquery="no" datepicker="no" require_entry="yes" class="form-horizontal" preserve_checkboxes="yes" }

The issue is that the user version of the form, which does not display the admin only fields, ends up wiping the values in the DB for those fields.

I am not presenting hidden fields and I not rendering the fields to the "user".

Does anyone have a solution to preventing fields not presented to the user from being cleared?

You're doing it wrong is an acceptable answer as long as you have a solution :-p

4
  • Are the field's getting wiped set as 'required'? Jun 12 '13 at 19:02
  • They are not required. Would this solve the issue?
    – Jordan
    Jun 12 '13 at 21:17
  • From the docs for preserve checkboxes. "You are provided this parameter to preserve the existing values without having to use a hidden field"
    – Jordan
    Jun 12 '13 at 21:26
  • Can you update the question with more of the template inside the safecracker tag? Sep 17 '13 at 2:00
1

I just addressed this same issue at http://ellislab.com/forums/viewthread/235757/

Basically you have to output that field value and just set visibility:false on the select tag.

1
  • Please copy the relevant parts of the page here. Links to other pages may come and go, and we prefer to keep all the knowledge in one place to make it easy for people searching for an answer :) Oct 17 '13 at 21:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.