Forums

Custom Front List wrongly rendered only for the first record

fasenderos 04 Feb, 2015
Hi,
I'm using the Custom display for the Front List.
In the Body Code section I have some "HTML/PHP code that it should be rendered once for every record in the list" like this:

<div>
    <p>{answer.title}</p>
    <form method="post" action="index.php?option=com_chronoforms5&view=form&Itemid=178&lang=it">
         <input type="hidden" name="answer_id" value="{answer.id}" />
         <input type="submit" value="Reply" />
    </form>
</div>


The problem is that this code is correctly rendered in each record except for the first one where is rendered without the form tag like this:

<div>
    <p>{answer.title}</p>
    <input type="hidden" name="answer_id" value="{answer.id}" />
    <input type="submit" value="Reply" />
</div>


I noticed that only the first record is enclosed in a form tag, probably this is the reason cause I think that there can not be a form within another for.
Here is the list rendered:

<div class="chrono-page-container">
       <form action="/index.php?option=com_chronoconnectivity5&cont=lists&ccname=Answers&Itemid=169&lang=it" method="post" name="admin_form" id="admin_form">
       <div>
            <p>{answer.title}</p>
            <input type="hidden" name="answer_id" value="{answer.id}" />
            <input type="submit" value="Reply" />
       </div>
       </form>
       <div>
           <p>{answer.title}</p>
           <form method="post" action="index.php?option=com_chronoforms5&view=form&Itemid=178&lang=it">
                <input type="hidden" name="answer_id" value="{answer.id}" />
                <input type="submit" value="Reply" />
           </form>
       </div>
       <div>
           <p>{answer.title}</p>
           <form method="post" action="index.php?option=com_chronoforms5&view=form&Itemid=178&lang=it">
                <input type="hidden" name="answer_id" value="{answer.id}" />
                <input type="submit" value="Reply" />
           </form>
       </div>
       <div>
           <p>{answer.title}</p>
           <form method="post" action="index.php?option=com_chronoforms5&view=form&Itemid=178&lang=it">
                <input type="hidden" name="answer_id" value="{answer.id}" />
                <input type="submit" value="Reply" />
           </form>
       </div>	
</div>


As you can see except for the first one, all the others record are correctly rendered.
What's wrong?
Thanks in advance
Max_admin 04 Feb, 2015
Answer
Hi fasenderos,

I think its because the whole list is inside form tags by default, so you can't use form tags in the body section, you will have to find some way to solve this, maybe pass the record id using the button's name or use javascript "onsubmit"

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
fasenderos 04 Feb, 2015
Hi Max,
this is exactly what I thought, thanks for confirming it.
I think I will use javascript onsubmit

Regards
This topic is locked and no more replies can be posted.