Displaying same form several times on single page

Dmayak 06 Feb, 2014
Hello, I have a page with vacancies inside accordion and every vacancy should have a upload CV form, just a file upload field and submit button, I am using the same form - but plugin applies it only to the first match, it still works on next mathes, but produces only the "powered by chronoforms" labes, without actual form. It seems not to be an error but some logical limitation, but I need it to be removed. I have tracked plugin actions and form get loaded fine, both matches gets the same event, but on this part
ob_start();
	HTML_ChronoForms::processView($form);
	$output = ob_get_clean();
output receives code without form on next match, and I haven't found where that functions are defined to understand what it does. Any advice?
GreyHead 06 Feb, 2014
Hi Dmayak,

You might try my Show HTML [GH] action which has a slightly different code structure. See if that avoids your problems.

Bob
Dmayak 06 Feb, 2014
Alas, your action produces the same result, I am trying to debug processView() without any significant results for now.
GreyHead 06 Feb, 2014
Hi Dmayak,

Hmmm . . . not sure what is happening here. Please post a link to the form so I can take a quick look.

Bob
Dmayak 06 Feb, 2014
http://test17.antagosoft.com/mirapolis/about-company#%D0%B2%D0%B0%D0%BA%D0%B0%D0%BD%D1%81%D0%B8%D0%B8, two links on the bottom are showing text on click. But the last time you have tried to enter the website there was a block from your antivirus, and I have contact malwarebytes and this shared ip will not be unblocked because there is a bunch of other websites sending malware or something: https://forums.malwarebytes.org/index.php?showtopic=136243, but there are no incidents with our domain.
GreyHead 07 Feb, 2014
Hi Dmayak,

I can see the problem OK. I don't know what causes it though. As you get the form in one accordion and the tag line in the next one I wonder if the plug-in doesn't see that there are two entries.

What are you using to create the accordion?

Bob
Dmayak 07 Feb, 2014
Hi, I am using a Flexicontent CCK, and this vacancies are the items of the same category, it's outputted by a Universal Content Module for FLEXIcontent and then I am using a few jQuery click events to show or hide it. The problem is very odd, since the plugin is detecting shortcode fine - debugging shows its launched on both shortcuts.
The action data is absolutely the same, but action file path gets different:
$viewFile = JPATH_SITE.DS."administrator".DS."components".DS."com_chronoforms".DS.'form_actions'.DS.$actiondata->type.DS.'cfaction_'.$actiondata->type.'.ctp';
					var_dump($viewFile);
					if(file_exists($viewFile)){
						ob_start();
						var_dump($viewFile);

first dump for both plugin calls produces file path to form_actions/show_val/cfaction_show_val.ctp, but for the first occurence ob_start() then changing it to form_actions/show_html_gh/cfaction_show_html_gh.ctp and in next calls it doesn't and cfaction_show_val.ctp gets included instead of cfaction_show_html_gh.ctp.
Oh, I have found it! The problem is in this lines:
if(!empty($actiondata->id)){
						if(in_array($actiondata->id, $viewed_actions)){
							continue;
						}else{
							$viewed_actions[] = $actiondata->id;
						}
					}

In the first call the $viewed_actions is empty, so code goes to "else" and adds an action id into an array, execution continues and does its magic🙂, but on the second run its already in array, so continue goes to the second foreach step, and cfaction_show_html_gh.ctp never gets included after first run. As I thought it is a logical limitation which disables actions already viewed, probably with a good reason, but I have to disable it - just commenting out continue makes plugin work as expected
if(in_array($actiondata->id, $viewed_actions)){
							//continue;
						}else{
							$viewed_actions[] = $actiondata->id;
						}
This topic is locked and no more replies can be posted.