Forums

"Thank you" page with only HTML code from "onSubmit" box?

areacode514 16 May, 2010
Greetings,

I have added some HTML code in the onSubmit section. Is there a way for the Thank You page to only show the HTML code I added, as opposed to showing it within the page layout of my site?

In other words, right now it's as if the HTML code was being considered a Joomla article content. So Joomla displays it all with the same look as the rest of the articles in the site.

What I want is to actually only display the content that I added in the onSubmit code, and nothing more.

Note: The reason I am using onSubmit, as opposed to just redirecting the Thank You page to a specific URL, is because I still want the Thank You message to have custom fields (i.e. first_name, last_name, etc.).

Thanks!

-areacode514
GreyHead 16 May, 2010
Hi areacode514,

I have done this to get a thank you page to show in a lightbox. The only way I found was to add a JavaScript snippet to rewrite the form action URL to add &tmpl=component to it.

Bob
areacode514 18 May, 2010
Hi Bob,

Thanks for your reply. Would you care to share (or point me in the right direction) the steps you did to add the Javascript snippet (i.e. where do I put it, what should it say,...)?

Regards,

areacode514
GreyHead 19 May, 2010
Hi areacode514,

Here's the script I used.
window.addEvent('domready', function() {
  var modal = $('modal').value;
  if ( modal == 'component' ) {
    var url = $('ChronoContact_test_form_29');
    var action = url.getProperty('action');
    url.setProperty('action', action+'&tmpl=component');
  }
});
Basically this check to see if there is a 'modal' (hidden) input and if there is it changes the form action.

I added the 'modal' input with this code in the Form HTML
<?php
if ( !$mainframe->isSite() ) { return; }
$modal = JRequest::getString('tmpl', 'false', 'get');
?>
<input type='hidden' id='modal' name='modal' value='<?=$modal?>' />
I did this so that the same form will display the 'Thank you' with the template normally or without it if 'modal=true' is in the URL.

Bob
areacode514 01 Jun, 2010
Hi Bob,

Thanks for your reply.

Unfortunately I am not extremely technically-inclined. Where exactly should I be putting that first script? In the HTML code for the after-submit text?

Also, in your code you mention "ChronoContact_test_form_29'". What should I use for my code? Should it be the form name?

Regards,

areacode514
GreyHead 01 Jun, 2010
Hi areacode514,

The script goes in the Form JavaScript box.

Bob

PS You may need some technically minded help to get this working.
This topic is locked and no more replies can be posted.