[support] Hidden fields with formfilter

Joel Willers joel.willers at sigler.com
Fri Jun 10 20:36:20 UTC 2011


Has anyone ever used the module formfilter and had the form error afterward? 

Here's the deal:  I am using Node Import 1.1 (in Drupal 6.19), to grab CSV files for a few content types.  A few users need access to this, but I don't want to offer every single content type (only the ones they need to import into).  

So I have used formfilter in the past, and it works great for me.  But when I limit certain items, the user gets an error message.
"An illegal choice has been detected. Please contact the site administrator."

Here is an example of the HTML that is shown with some hidden and others not:
<input type="hidden" name="type" id="edit-type-node:feedback" value=""  /> 
<input type="hidden" name="type" id="edit-type-node:food-bev" value=""  /> 
<input type="hidden" name="type" id="edit-type-node:forum" value=""  /> 
<div class="form-item" id="edit-type-node:category-wrapper"> 
 <label class="option" for="edit-type-node:category"><input type="radio" id="edit-type-node:category" name="type" value="node:category"   class="form-radio" /> <em>General Category</em> content type</label> 
</div> 
<div class="form-item" id="edit-type-node:lead-wrapper"> 
 <label class="option" for="edit-type-node:lead"><input type="radio" id="edit-type-node:lead" name="type" value="node:lead"   class="form-radio" /> <em>Lead</em> content type</label> 
</div>

Here is the HTML for the form that causes the errors:
<input type="hidden" name="type" id="edit-type-node:feedback" value=""  /> 
<input type="hidden" name="type" id="edit-type-node:food-bev" value=""  /> 
<input type="hidden" name="type" id="edit-type-node:forum" value=""  /> 
<input type="hidden" name="type" id="edit-type-node:category" value=""  /> 
<div class="form-item" id="edit-type-node:lead-wrapper"> 
 <label class="option" for="edit-type-node:lead"><input type="radio" id="edit-type-node:lead" name="type" value="node:lead"   class="form-radio" /> <em>Lead</em> content type</label> 
</div>

As you can see, I just hid the 'Category' content type and POOF!  Illegal choice.  After digging around in Googleville, it seems there may be a Drupal issue with hidden inputs, maybe, but I didn't find much on it, only some 'I have a patch for that' messages.  

At first I wondered if I just had too many hidden ones, but it seems that even if only one 'problem' item is hidden, it still errors.  I've done Diffs on the HTML, and the only difference is the one shown above (and a form key, but that is expected).  

Any ideas?  I really don't want to have to re write the entire Node Import module as a custom module for this one silly problem.

Joel 



More information about the support mailing list