2 Forms in content with if not work

enkacom 23 May, 2009
Hi, i have a list of events, and have 2 forms, registered and unregistered users.

Y test some codes, and none works.


<?php
$user =& JFactory::getUser();
if ($user->id==0) {
    echo "{chronocontact}curso_no_registrados{/chronocontact}";
} else {
    echo "{chronocontact}curso_registrados{/chronocontact}";
}
?>

{chronocontact}<?php  
$user = &JFactory::getUser(); 
$no_reg="curso_no_registrados";
$reg="curso_registrados";
if ($user->id==0){ 
	echo $no_reg; 
}else{  
	echo $reg;  
} ?>{/chronocontact}


First code not display any message, the second code return:

There is no form with this name or may be the form is unpublished, Please check the form and the url and the form management

The simple insert {chronocontact}curso_no_registrados{/chronocontact} work good. Name forms it's good and forms published.

Any suggestions?

ChronoContact 3.0 STABLE
Plugin 0.8/V3.0 Stable
Joomla 1.5.10
GreyHead 23 May, 2009
Hi enkacom,

Where are you putting this code? Joomla articles don't support PHP.

You need to create a single form and put the PHP to identify the user in the Form HTML then display the appropriate form code.

Bob
enkacom 23 May, 2009
I user directPHP plugin, if i print name of forms, php work good in content.

I create new form with chrono, and put into this code:


<?php
$user =& JFactory::getUser();
if ($user->id==0) {
    echo "{chronocontact}curso_no_registrados{/chronocontact}";
} else {
    echo "{chronocontact}curso_registrados{/chronocontact}";
}
?>


But when i open de form y see:

{chronocontact}curso_no_registrados{/chronocontact}


And with this code into form:

<?php
$user =& JFactory::getUser();
if ($user->id==0) {
    ?>{chronocontact}curso_no_registrados{/chronocontact}
<?php
} else {
?>
{chronocontact}curso_registrados{/chronocontact}
<?
}
?>


I see:

There is no form with this name or may be the form is unpublished, Please check the form and the url and the form management

Thanks for answering so fast
GreyHead 23 May, 2009
Hi enkacom,

You can't use the ChronoForms plugin inside ChronoForms. Please do as I suggested in my last post:
<?php
$user =& JFactory::getUser();
if ($user->id==0) {
    //some form code here
} else {
    // some other form code here
}
?>

Bob
enkacom 25 May, 2009
Hi bob

Ok i have first problem solved with you code, now i have other problem.

This forms need 2 action, form for not registered users have registered user and post in external url. And form for registered user post in externarl url.

I'm testing with javascript:


function enviar_form()
{
document.test.action="https://www.xxxx.com/xxxx.php";
document.test.submit();

}

I call function when finish On Submit code - after sending email. But for the momento only post in internal url.

Thanks you ^^
GreyHead 25 May, 2009
Hi enkacom,

I'm sorry but I have no idea what you are asking here??

Bob
Max_admin 26 May, 2009
Hi,

try to put "https://www.xxxx.com/xxxx.php" in the submit url field in the form edit page, pay attention that this will disable all Chronoforms functions including emails..etc

Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
enkacom 26 May, 2009

Hi,

try to put "https://www.xxxx.com/xxxx.php" in the submit url field in the form edit page, pay attention that this will disable all Chronoforms functions including emails..etc

Cheers
Max



Hi all

That is exactly my problem, i need send my form to external page and the same form have register users. When user send form, first register user and after send his information to other page.

2 action 1 form.

thx
GreyHead 26 May, 2009
Hi enkacom,

Then you will probably need to use the CURL plugin to send results to the external form.

Bob
enkacom 26 May, 2009
^^ Solved

I use javascript, explained here, but I had to make some change

http://www.webdeveloper.com/forum/showthread.php?t=89922


My source:


<div style="visibility:hidden">
<iframe name="ifr1" width="20" height="20"></iframe>
</div> 


function submitTwice(f){

f.action = 'url crhono_form';
f.submit();

f.action = 'external url';
f.target='ifr1';
f.submit();
} 



First send chronoform without iframe in this moment chronoforms functions work, and the second url with iframe.
Max_admin 27 May, 2009
Thanks for sharing!🙂

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
enkacom 04 Jun, 2009
Hi ^^

Today i read this post:

http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=5&t=14105&start=15

I use my forms with salesforce and curl solved my problems and it's more efficient. I install new chronos and install files to patch plugin in post.

But now i have a bug. In general tab i copy all of my fields correct save and send form, now this work good form validate captcha and send correct to salesforce, but when i rentry to curl general tab 2 of my fields change value, can see in screens.
GreyHead 04 Jun, 2009
Hi enkacom,

ChronoForms shouldn't change those for you!

But are you sure that you have the correct field names in there 'Escribir e-mail' isn't a valid field name (it has spaces and a hyphen).

Bob
enkacom 05 Jun, 2009
Hi i put state and email correct, i use form, work correct, i return to chronos enter to curl options and appears 'Escribir e-mail' and 'estado' i not put this i put state and email.

The question is because it appears at once "estado" and "Escribir e-mail" when i put state and email xD


EDITED:

Problem solved, i remove patched files, and reupload original files, now work good ^^

Thanks for your time. And sorry...
This topic is locked and no more replies can be posted.