Hi Bob,
I have one url like this: http://www.xyz.com/index.php/folder/user/robert,785
where robert is the user name and 785 is the id. Both are form results
This guide: https://www.chronoengine.com/faqs/56-cfv4/cfv4-other-faqs/2694-how-can-i-show-a-thanks-message-then-redirect-the-user.html:
"If you want to use a variable URL - to redirect the user to different pages depending on the form results then you can set a URL using the ReDirect URL action and then use this version of the code in the Custom Code action.
<?php
$doc = \JFactory::getDocument();
$doc->setMetaData('refresh', '5;url='.$form->data['redirect_url'].'', 'true');
?>"
Can you help me to understand how to use the ReDirect URL action to construct the desired URL?
Thanks a lot!
Kwok
I have one url like this: http://www.xyz.com/index.php/folder/user/robert,785
where robert is the user name and 785 is the id. Both are form results
This guide: https://www.chronoengine.com/faqs/56-cfv4/cfv4-other-faqs/2694-how-can-i-show-a-thanks-message-then-redirect-the-user.html:
"If you want to use a variable URL - to redirect the user to different pages depending on the form results then you can set a URL using the ReDirect URL action and then use this version of the code in the Custom Code action.
<?php
$doc = \JFactory::getDocument();
$doc->setMetaData('refresh', '5;url='.$form->data['redirect_url'].'', 'true');
?>"
Can you help me to understand how to use the ReDirect URL action to construct the desired URL?
Thanks a lot!
Kwok
Hi Kwok,
I probably wouldn't use the SEF version of the URL but as that is all we have here.
Bob
I probably wouldn't use the SEF version of the URL but as that is all we have here.
<?php
$url = JURI::root()."index.php/folder/user/{$form->data['name']},{$form->data['id']}";
. . .
Bob
Hi Bob,
I did this:
but $url seems not have the name and id resolved so the redirect fails to go to the right page.
I have set the debugger which does not show what $url contains. Help!!
Thanks,
Kwok
I did this:
<?php
$url = JURI::root()."index.php/folder/user/{$form->data['name']},{$form->data['id']}";
$doc = \JFactory::getDocument();
$doc->setMetaData('refresh', '5;url='.$url, 'true');
?>
but $url seems not have the name and id resolved so the redirect fails to go to the right page.
I have set the debugger which does not show what $url contains. Help!!
Thanks,
Kwok
Hi Kwok,
Please try this to see the URL you are building
Bob
Please try this to see the URL you are building
<?php
$url = JURI::root()."index.php/folder/user/{$form->data['name']}.{$form->data['id']}";
echo'<div>$url: '.print_r($url, true).'</div>';
$doc = \JFactory::getDocument();
//$doc->setMetaData('refresh', '5;url='.$url, 'true');
?>
Bob
Hi Bob,
You are genius!
The second $form should be {$form->data['Data1']['id']} and the re-direct works good now.
I also use a Display Message as follows when the user is not found in our system:
Sorry, {username} is not found in our system!
Is there a way to display it inside a pop-up window so visitor can close it after viewing and the input field of the form is ready to take another user name?
Right now, the input field is overlayed by the message. Refreshing the browser doesn't show the input field. I have to click on the page link that carries the form.
Thanks,
Kwok
You are genius!
The second $form should be {$form->data['Data1']['id']} and the re-direct works good now.
I also use a Display Message as follows when the user is not found in our system:
Sorry, {username} is not found in our system!
Is there a way to display it inside a pop-up window so visitor can close it after viewing and the input field of the form is ready to take another user name?
Right now, the input field is overlayed by the message. Refreshing the browser doesn't show the input field. I have to click on the page link that carries the form.
Thanks,
Kwok
Hi Kwok,
This StackOverFlow answer suggest one way that might work. Note that you replace $ with jQ to use that with my code example.
Bob
This StackOverFlow answer suggest one way that might work. Note that you replace $ with jQ to use that with my code example.
Bob
Hi Bob,
I added a custom code as the following:
Run the form and "Open Dialog" is displayed but not clickable.
I must have missed something.....
Merry Christmas!
Kwok
I added a custom code as the following:
<script type="text/javascript">
jQ(document).ready(function() {
jQ('#dialog_link').click(function () {
jQ('#dialog').dialog('open');
return false;
});
});
</script>
</head><body>
<div id="dialog" title="Dialog Title" style="display:none">Thank you!</div>
<p id="dialog_link">Open Dialog</p>
</body></html>
Run the form and "Open Dialog" is displayed but not clickable.
I must have missed something.....
Merry Christmas!
Kwok
Hi Kwok,
With a few bugs fixed this version works OK
+ I corrected the first line of the JavaScript to define the jQ short-cut
+ I added a line to define the dialogue
+ I added an <a> tag to the link so that it looks clickable (it works without though).
Bob
With a few bugs fixed this version works OK
<script type="text/javascript">
jQuery(document).ready(function(jQ) {
jQ( "#dialog" ).dialog({ autoOpen: false });
jQ('#dialog_link').click(function () {
jQ('#dialog').dialog('open');
return false;
});
});
</script>
<div id="dialog" title="Dialog Title" style="display:none">Thank you!</div>
<p><a id="dialog_link">Open Dialog</a></p>
+ I corrected the first line of the JavaScript to define the jQ short-cut
+ I added a line to define the dialogue
+ I added an <a> tag to the link so that it looks clickable (it works without though).
Bob
Hi Bob,
Great! The dialog box, by itself, works like a chime.
But it still does not solve the issue:
1. I create a chronoform module and then put it inside a customHTML module that is set to display that chronoform form inside a modal box.
2. After I filled the form and pressed the submit button, there was no new display
3. Then, I click on the customHTML link again to find the "Open Dialog" link inside the chronoform window. Upon click, a new dialog box with "Thank you" inside it while the chronoform window disappears. Then I closed the dialog box.
4. When I click on the customHTML link again to try to fill the form again, the "Open Dialog" link still sticks to the chronoform window. Refreshing the browser doesn't get rid of the residual chronoform window. I have to click on the page link that carries the form.
The ideal solution seems to be:
1. Upon submission of the form, a pop-up window is displayed with the message.
2. Once user close the pop-up window, he is re-directed to the same web url where he filled the form.
Please kindly suggest any idea that can make the above happens.
Thanks,
kwok
Great! The dialog box, by itself, works like a chime.
But it still does not solve the issue:
1. I create a chronoform module and then put it inside a customHTML module that is set to display that chronoform form inside a modal box.
2. After I filled the form and pressed the submit button, there was no new display
3. Then, I click on the customHTML link again to find the "Open Dialog" link inside the chronoform window. Upon click, a new dialog box with "Thank you" inside it while the chronoform window disappears. Then I closed the dialog box.
4. When I click on the customHTML link again to try to fill the form again, the "Open Dialog" link still sticks to the chronoform window. Refreshing the browser doesn't get rid of the residual chronoform window. I have to click on the page link that carries the form.
The ideal solution seems to be:
1. Upon submission of the form, a pop-up window is displayed with the message.
2. Once user close the pop-up window, he is re-directed to the same web url where he filled the form.
Please kindly suggest any idea that can make the above happens.
Thanks,
kwok
HI Kwok,
I have no idea what you are trying to do here. As soon as you put a form in a module in another module in a modal window I'm lost.
Why not use an iframe in a modal window?
Bob
I have no idea what you are trying to do here. As soon as you put a form in a module in another module in a modal window I'm lost.
Why not use an iframe in a modal window?
Bob
Hi Bob,
Sorry for the confusion. Let me clarify:
I use a joomla plugin extension that allows any module to display inside a modal window by placing the inside module id inside a customHTML module like this:
<div><a href="#modalbox398" id="398" class="wkmodalbox">Check user</a></div>
Here 398 is the id of the chronoform form module
When the link is clicked, the chronoform is displayed inside a modal window.
Thanks.
Kwok
Sorry for the confusion. Let me clarify:
I use a joomla plugin extension that allows any module to display inside a modal window by placing the inside module id inside a customHTML module like this:
<div><a href="#modalbox398" id="398" class="wkmodalbox">Check user</a></div>
Here 398 is the id of the chronoform form module
When the link is clicked, the chronoform is displayed inside a modal window.
Thanks.
Kwok
This topic is locked and no more replies can be posted.