Página de Agradecimiento no funciona

  • galiciatv.es@gmail.com
  • galiciatv.es@gmail.com's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 10
  • Thank you received: 0

galiciatv.es@gmail.com created the topic: Página de Agradecimiento no funciona

Best regards.

I have created an 8-page form, and there are some things that are not going well for me.

1. the welcome page does not show it.
I have followed some indications, such as diverting to a URL, but this does not help me, because I do not want to take the user to an article that has to be exposed.
The only thing is that it ends with the last thank-you page, thus ensuring the user has finished completing the form.

2. I had created a field that calculated the age, consulting another Calendar field, but the script stopped working by adding another scrip that captures the title of the article.
I need some help to be able to deliver this project. Can you take a look at my form?
Thanks in advance
#226296
  • Posts: 3128
  • Karma: 105
  • Thank you received: 411

mihaela replied the topic: Página de Agradecimiento no funciona

Hello,

1. Regarding the Thank you page, it is not necessary to redirect to a different url. There is an easy way how to make the last page of your form Thank you page. Just add one more page to your form and do as explained here crosstec.org/en/support/online-documenta...-thank-you-page.html .

2. Regarding the script, could you send me the code that you have in the script so I can look into that. Does the script that captures the title of the article works for itself if you remove have the script for calculating age?

Regards,

Mihaela
#226324
  • galiciatv.es@gmail.com
  • galiciatv.es@gmail.com's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 10
  • Thank you received: 0

galiciatv.es@gmail.com replied the topic: Página de Agradecimiento no funciona

Hello Mihaela, thanks for answering.

Regarding the thank-you page, at the beginning it worked very well ... but I stopped doing it and I tried almost everything to force me to go to the last page.
If you like, I'll send you a copy of my form for you to examine.... The form is in Galician language.

the second point I try to join 2 scripts:
1 The field that calculates the age is on Page 1 SOLICITANTE: "Idade" (solicitante_idade) and must take the date from the field of the calendar that is next: "Data de nacemento" (solicitante_data).
2 The field that shows the title of the article is in Page 1 ACTIVIDADE: "Inscrición da actividade" (tituloarticulo), and the script in advanced options, sending of script.
Both scripts work correctly separately, but together they do not go ... I'm doing something wrong here, I'm still an amateur at Breezinforms! and I apologize for my ignorance.


These are the scripts:

1 SHOW THE ARTICLE TITLE

function ff_formulario_inscricion_v1_init()
{
ff_getElementByName('tituloarticulo').value = window.parent.document.title;
}


2 CALCULATE AGE

function ff_formulario_inscricion_v1_init()
{
setInterval('showage()',500);

} // ff_calc_age_init

function showage(){
var one_year=1000*60*60*24*365;
var date1 = new Date();

var dob= ff_getElementByName('data_nacemento').value;
var tmp=ff_getElementByName('data_nacemento').value.split("/");
var date2=new Date(tmp[2],tmp[1]-1,tmp[0]);

var pattern = /[0-3][0-9]\/(0|1)[0-9]\/(19|20)[0-9]{2}/; //Regex to validate date format (dd/mm/yyyy)
if (pattern.test(dob)) {
var y1 = date1.getTime(); //getting current year
var y2 = date2.getTime(); //getting dob year
var diff=Math.floor((y1-y2)/one_year);

ff_getElementByName('idade_solicitante').value=diff;

}

}
#226361
Attachments:
  • Posts: 3128
  • Karma: 105
  • Thank you received: 411

mihaela replied the topic: Página de Agradecimiento no funciona

Hello again,

Here is how to make both scripts work at the same time. Please, in the Initialization script put this code:
function ff_formulario_inscricion_v1_init()
{
ff_getElementByName('tituloarticulo').value = window.parent.document.title;
setInterval('showage()',500);
}


function showage(){
var one_year=1000*60*60*24*365;
var date1 = new Date();

var dob= ff_getElementByName('data_nacemento').value;
var tmp=ff_getElementByName('data_nacemento').value.split("/");
var date2=new Date(tmp[2],tmp[1]-1,tmp[0]);

var pattern = /[0-3][0-9]\/(0|1)[0-9]\/(19|20)[0-9]{2}/; //Regex to validate date format (dd/mm/yyyy)
if (pattern.test(dob)) {
var y1 = date1.getTime(); //getting current year
var y2 = date2.getTime(); //getting dob year
var diff=Math.floor((y1-y2)/one_year);

ff_getElementByName('idade_solicitante').value=diff;
}

}
The problem was that you mustn't define function ff_formulario_inscricion_v1_init() twice. I've tested this script on your form and it works fine. It calculates age and shows the title of the article as it should.

Regarding the problem with the thank you page, please In the End submit pieces, try to delete this part from the code:
$this->execPieceByName('ff_InitLib');
ff_redirect('http://www.gabinetesoutomaior.com/index.php/axenda-municipal2', parent);
and just leave this part:
$this->execPieceByName('ff_InitLib');
  include_once(rtrim(JPATH_ADMINISTRATOR,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'components'.DIRECTORY_SEPARATOR.'com_acymailing'.DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'helper.php');
 
 $myUser = new stdClass();
 $myUser->email = strip_tags(ff_getSubmit('email_solicitante'));
 $myUser->name = strip_tags(ff_getSubmit('nome_solicitante'));

 $subscriberClass = acymailing_get('class.subscriber');
 $subid = $subscriberClass->save($myUser);
 
$subscriberClass->sendConf($subid); //we send the confirmation email... only if needed based on the current user status and the option from the Acy configuration page.

 $subscribe = array(1); //Specify here the ID of your lists separated by a comma, in this example the user will be subscribed to lists IDs 3,4 and 5.
 $newSubscription = array();
 if(!empty($subscribe)){
 foreach($subscribe as $listId){
 $newList = array();
 $newList['status'] = 1;
 $newSubscription[$listId] = $newList;
 }
 }
 $subscriberClass->saveSubscription($subid,$newSubscription);
I've tested it and it took me to the Thank you page (the last page of your form).
Please test this and let me know whether it works for you.

Regards,

Mihaela
#226459
The following user(s) said Thank You: galiciatv.es@gmail.com
  • galiciatv.es@gmail.com
  • galiciatv.es@gmail.com's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 10
  • Thank you received: 0

galiciatv.es@gmail.com replied the topic: Página de Agradecimiento no funciona

Hello Mihaela, thanks for answering.

This has worked perfect !, thank you very much. now both scripts are working. Now a question, in the form there are more age fields, should I copy the complete code or part of it ?, Thanks for your reply
#226549
  • Posts: 3128
  • Karma: 105
  • Thank you received: 411

mihaela replied the topic: Página de Agradecimiento no funciona

Hello again,

Great! I'm glad that it works. :)

Regarding the question for more age fields, here is the change you have to make in the code:
function ff_formname_init()
{setInterval('showage()',500);
} // ff_formname_init

function showage(){
var one_year=1000*60*60*24*365;
var date1 = new Date();

var dob= ff_getElementByName('data_nacemento').value;
var tmp=ff_getElementByName('data_nacemento').value.split("/");
var date2=new Date(tmp[2],tmp[1]-1,tmp[0]);

var pattern = /[0-3][0-9]\/(0|1)[0-9]\/(19|20)[0-9]{2}/; //Regex to validate date format (dd/mm/yyyy)
if (pattern.test(dob)) {
var y1 = date1.getTime(); //getting current year
var y2 = date2.getTime(); //getting dob year
var diff=Math.floor((y1-y2)/one_year);

ff_getElementByName('idade_solicitante').value=diff;
}

//Here is the code for new calendar and age field
var dob3= ff_getElementByName('data_nacemento2').value;
var tmp3=ff_getElementByName('data_nacemento2').value.split("/");
var date3=new Date(tmp3[2],tmp3[1]-1,tmp3[0]);

if (pattern.test(dob3)) {
var y1 = date1.getTime(); //getting current year
var y3 = date3.getTime(); //getting dob3 year
var diff3=Math.floor((y1-y3)/one_year);

ff_getElementByName('idade_solicitante2').value=diff3;
}

}
NOTE: In the code above I assumed that the Name of other calendar field is data_nacemento2 and that idade_solicitante2 is the Name of the other age field.

I hope everything is clear to you.
If you have more questions, feel free to ask.

Regards,

Mihaela
#226564
The following user(s) said Thank You: galiciatv.es@gmail.com
Moderators: ForumSupporttomeperica
Time to create page: 0.105 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans, templates and icon packs!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here