How could I achieve this

HSN 27 Jun, 2010
I am planning on making use of rokbox, unfortunately it doesnt work in module positions unless you use the standalone version ::sigh:: but this is a different matter.

Anyway im loading the form into rokbox using the index2.php url instead of index.php so that the layout is not rendered and all you see is the form in the pop up box.
Now aafter submitting their info I want the form to perform task=send by means of using the On Submit code - after sending email: in the form code tab.

The problem with this is that this obviously redirects to index.php etc etc and thus the layout is once again in place.
I have tried using the redirect field under the general tab, but I got a message telling me that the page is not accessible or something.

So im wondering, how could I achieve this goal... I dont need this for every form, so I dont fancy hardcoding the changes, as this will have the reverse effect if the form is loaded in the article or module position.

Has anyone got any ideas, as I want to display the info they have just submitted along with a thank you note.

Many thanks,
GreyHead 27 Jun, 2010
Hi HSN,

There are a couple of ways round this. The simplest is to put the submit URL with &tmpl=component added in the Submit URL box. This will work OK with the RokBox I think. But not with a 'normal' display in an article or module. You could use two copies of the form; or add a script snippet to rewrite the form action if it is displayed in a RokBox.

Bob
HSN 27 Jun, 2010
Hi Bob,

Ahh the tmpl=component one I should have remembered, but this I believe creates an error in IE, it still displays but with errors if I remember rightly.

Ill have a look and see what the difference is, but am sure all styling is lost this way also.. id have to double check.

As with regards to coding.....😑 im lost lol.
GreyHead 28 Jun, 2010
Hi HSN,

Shouldn't be in the ReDirect URL box - the Submit URL one instead.

Bob
HSN 29 Jun, 2010
Doh,

Silly me lol.

Yep that works now. Cheers bob,

Regards,

Tom.
HSN 29 Jun, 2010
Actually Bob,

One further question really, as im using the component only view with the form, where and how would I edit the code to include a new css file if url includes &tmpl=component ?

Im assuming you would need to include an if statement right before the include once call, but as im not php orientated im not 100% sure as to how to do this.

Its basically so I can tart the form up a little lol.

Kind regards,

Tom.
GreyHead 01 Jul, 2010
Hi Tom,

I think you could do this:
<?php
if ( !$mainframe->isSite() ) { return; }
$tmpl = JRequest::getString('tmpl', '', 'get');
if ( $tmpl ) {
  $doc =& JRequest::getDocument();
  $doc->addStyleSheet('some_file_url');
}
?>

Bob
HSN 01 Jul, 2010
Hi Bob,

Thanks for that, I will try that soon.

I am assuming that the identifier in that bit of code is this line
$tmpl = JRequest::getString('tmpl', '', 'get');


In what file would it be best to place this small bit of javascript then? I would have thought in one of the main files so it checks on every page thats loaded containing a form.

Kindest regards,

Tom.
GreyHead 02 Jul, 2010
Hi Tom,

This is PHP, not JavaScript and needs to go in your Form HTML

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