Fieldtype

Developer
Supported

Catchall

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Vector Media Group

     

You must be logged in to post.

Catchall with dynamic fields from channel

General

Karimov
Karimov

Hello,

I have a channel with questions which I want to dynamically generate the input fields in safecrackers catchall segment. But I’m getting blank, see the code below.

{if catchall}
{submitedform_data}

{exp
:channel:entries channel="online_sport_event" dynamic="no" status="Open"}

{if 
"{related_entries id="game_main_event_sport"}{entry_id}{/related_entries}"=="{segment_3}"}
{if 
"{related_entries id="game_main_event"}{entry_id}{/related_entries}"=="{segment_4}"}
FORM NAME{title}<br>
Event Type{sport_event_type}<br>
Max allowed participants{online_sport_event_number_team}<br>

<
br>


 
{reverse_related_entries channel="online_form_questions" status="Open"}
   Question
{title}-- {online_form_question_type} --
   
   
{if "{online_form_question_type}"=="TEXT"}
    
<input type="text" name="submitedform_data[{entry_id}-{url_title}]">

   
{if:else}
    
<select name="{entry_id}-{url_title}">
    
{embed="onlinemembers/fill_the_form_answers" entry_id="{entry_id}"}
    
</select>
   
{/if}

   
<br>

 
{/reverse_related_entries}
{
/if}
{
/if}

  


{
/exp:channel:entries}
{
/submitedform_data}
{
/if} 

Is it possible, to do it this way?

 

mahuti
# 1
Developer
mahuti

This question is really about EE parsing rather than what catchall can do. If you had this in a form:

  <input type=“text” name=“submitedform_data[123-something]”>

catchall would capture the data. So the question you’re really asking is:

“why isn’t my channel entries loop outputting reverse related entry data”

Right? 

Even though this isn’t exactly a catchall question, I might be able to help anyway. What actually IS being output in your channel entries loop?

Karimov
# 2
Karimov

Thanks for the help

Actually if I take off the catchall tag it parses everything fine, do I need to use the if catchall,

or can literally just use the following syntax for the name and it will do the job?

submitedform_data[210-question-2-badminton]

...
<
select name="208-question-1-for-badminton-form">
    
 <
option value="">Select</option
 
  <
option value="213">answer 1</option
 
  <
option value="214">answer 2</option
 




    </
select>
   
   <
br>

 
   
QuestionQuestion 2 Badminton-- TEXT --
   
       <
input type="text" name="submitedform_data[210-question-2-badminton]">

   
   <
br>

 
   
QuestionQ3-- TEXT --
   
       <
input type="text" name="submitedform_data[211-q3]">

   
   <
br>
... 
mahuti
# 3
Developer
mahuti

or can literally just use the following syntax for the name and it will do the job?

Yes. You can literally do that. Catchall doesn’t start with any field formatting or preset fields on a new entry. It’s completely blank. It’ll take first and second level arrays of data automatically. So:

<input type="text" value="123" name="my_catchall_field[address][number]" /> 
<
input type="text" value="tesville" name="my_catchall_field[address][city]" /> 
<
input type="text" value="mo" name="my_catchall_field[address][state]" /> 
<
input type="text" value="USA" name="my_catchall_field[address][country]" /> 
<
input type="text" value="Joe" name="my_catchall_field[first_name]" /> 
<
input type="text" value="Tester" name="my_catchall_field[last_name]" /> 

 

You wouldn’t have to output the catchall field to capture data. You just throw data at it like in the above example.