How to post a form at external url in cake php.? - cakephp

I am going to implement paypal in cake php. I have two conditions to post the form.
Fist posts the form to paypal, if user click on paypal button. Then form shoud be posted at paypal url at : https://www.paypal.com/cgi-bin/webscr .
If user click on submit button form should be posted to it controller.
It means i want to create two forms at a single page and want to posts at different places in certain conditions.
If I am giving custom action in form, it is adding app name+controller name before the url. like: appname/controllername/http://google.com. but want only http://google.com .I want to remove appname/controllername from the url.
How do I do this? Thanks in advance.

In your form creation call, you need to specify the URL
echo $this->Form->create('Model', array('url' => 'http://google.com'));

Related

MS Access - SubForm field pass through

I have a Navigation Form in which the first button is defaulted to show a blank form (Request form) where users will enter information.
There's an option on this Request form that if there are multiple requests under this request, `a box is checked and another form opens and the request number from the Request form is defaulted into the multiple request form's request number field (this is the link).
On the Multiple Request window's ID field in Property Sheet/Data/Default Value I have =[Forms]![frmRequests]![RequestID]
With the Request form open on its own, this works great, but within the Navigation form it doesn't. Is there another layer that I need to add so the default value works in either format? I will be using it in the Navigation form primarily.
The following worked for me.
=Forms!NavigationFormName.NavigationSubformName.Form!RequestID

To show different list page for different profile

I have two vf pages, say vf1 and vf2, which have standard controller for same object say Leads. Now i want to show vf1 page for edit button for any profile1 and and vf2 page for profile2 on edit button.
Tried to see any option in Profile menu, but not able to find anything for page assignment for list/edit/create/...etc. for an object.
There is no such feature in Salesforce to allow visualforce page assignment per profile.
I would recommend below
1.Create a hirerachy custom setting to store the mapping between the vf page and the profile .
2.Write a vf that will be assigned for all profiles but on action (called upon where page loads) it will look into the hirerachy custom settings map and takes the user to right visualforce page .You can pass along page parameters as query parameters .

Cakephp One login function / multiple login views

I have one website with a login system. However, I would like the login view to be different depending on what link has the user used to get to the login screen.
Something like:
function login ($from_page = null) {
if (isset($page)) $this->render('login_alternate_view');
else $this->render('login'); //default login view
}
And then each of the login views (login.ctp, login_alternate_view.ctp) would have the login form plus other stuff specific to each one.
Is this possible in some way? I've already tried something like the example above but it doesn't work...
So I fixed it using GET variables:
/users/login?some_var=some_value
And then in the login function I catch that variable's value with:
$this->params['url']['some_var'];
This way I can "customize" my login function depending on the link the user uses
First show the real error message you're talking in the comments about and not "something".
I guess that you want the current page url the user is on when he logs in? How to you generate the modal? Request the whole form via ajax or is it embedded in the page you're on? If it's embedded I would put the current page url the user is on in a hidden field "from" in the login form and check that.

CakePHP Logs Me Out Prematurely

I have a CakePHP app that seems to be terminating my session on one specific action. I have a page which, when a link is clicked, launches a Fancybox overlay of the iframe type. In that overlay, the user fills out and submits a form. The form is submitted properly, does its work (including sending an email), loads the success view and lets me close the overlay, but as soon as I try to get to any other page, I'm sent to the login screen to reauthenticate.
The value of my Security.level config setting is medium and my Session.timeout is 120, so that shouldn't be the problem. Anyone have any idea what could be creating this?
Thanks.
is it possible that your ajax calls and redirects are not going to the same place, eg www.site.com and site.com? I have had that before and also kept getting logged out.
So this wasn't fun to track down, but it was me being an idiot. Buried in the code was some early-stage code to refresh user data in the authenticated session that wasn't doing what it should have been doing. It was attempting to update the entire Auth.User object directly (e.g. $this->Session->write( 'Auth', $user )) instead of calling the login method.
Once I changed the Session::write() code to $this->Auth->login( $user ), everything lined up nicely. A nice bit of reference material on this subject at http://milesj.me/blog/read/31/Refreshing-The-Auths-Session.

Using Ajax with cakephp

HI I am new to cakephp so any help would be grateful.
I have created a form and with one of the fields when the user has filled in checks to see it it already exists and offers other suggestions. I have used the Ajax observerField method to do this. I want the user to be able to click on the suggested names(radioboxes) and then it update the field in the other form. What is the best way to achieve this in cakephp?
If it was me, I would create a form field
echo $form->input('otherfield');
Then use javascript to catch the click on the suggested radio, and copy the value into that field.
In jQuery,
$('#suggestions input[type=radio]').click(function(){
$('#otherfield').val() = $(this).val();
});
Then when the form is submitted you will have it in,
$this->data['Model']['otherfield']

Resources