Thursday, December 30, 2010

Re: post form data from URL

Sorry, I'm still up in the air with this...

<?php echo Router::url($this->here, true); ?> echos
localhost/links/add/cakephp.org if I type
"localhost/links/add/cakephp.org" as the URL. How do I pass just
'cakephp.org' to the form?


To confuse things I got looking more at
http://book.cakephp.org/view/945/Routes-Configuration#Passing-parameters-to-action-949...

Perhaps this is good?:
function add() {
Router::url('links/add/:url',array('controller' => 'links',
'action' => 'add'), array('pass' => array('url')));
}

I'm still confused on how 'pass' 'url' to the form.

Thanks for the help so far.
Steve

On Thu, Dec 30, 2010 at 2:14 PM, Karthikeyan P <pkaarthikeyan@gmail.com> wrote:
> It seems easy one .
>
> <?php echo Router::url($this->here, true); ?>
>
>
> assign the same to a variable and then send it to Form->Input
>
> Thanks
> Karthik
>
> On Thu, Dec 30, 2010 at 10:20 PM, Steve Mallett <steve.mallett@gmail.com>
> wrote:
>>
>> ping. sorry.
>> S
>>
>> On Thu, Dec 30, 2010 at 9:15 AM, Steve Mallett <steve.mallett@gmail.com>
>> wrote:
>> > Sorry, no. I'd like to populate the form data from variables given in
>> > the url:
>> > localhost/links/add?url=http://cakephp.or
>> >
>> > This would be like a delicious.com bookmarklet or someone creating a
>> > link on their own sites which would populate the form data.
>> >
>> > Steve
>> >
>> >
>> > On Thu, Dec 30, 2010 at 1:07 AM, Karthikeyan P <pkaarthikeyan@gmail.com>
>> > wrote:
>> >> I guess I got your question correctly, what u want to do is
>> >> Pre-Populate the
>> >> form on loading
>> >>
>> >> I think you have to see the EDIT function in the BLOG tutorial of
>> >> cakePHP.
>> >> There we actually PRE-POPULATE the data on the EDIT page .
>> >>
>> >> Thanks
>> >> Karthikeyan P
>> >>
>> >> On Thu, Dec 30, 2010 at 8:14 AM, Steve Mallett
>> >> <steve.mallett@gmail.com>
>> >> wrote:
>> >>>
>> >>> Hi,
>> >>>
>> >>> How do I pass data to a Form from the URL?
>> >>>
>> >>> I have add.ctp:
>> >>>
>> >>>        <?php
>> >>>                echo $this->Form->input('url', array(
>> >>>                  'type' => 'text',
>> >>>                  'value' => $this->params['url']
>> >>>                ));
>> >>>        ?>
>> >>>
>> >>> Hitting localhost/links/add?url=http://cakephp.org produces the
>> >>> following
>> >>> error:
>> >>>
>> >>> Notice (8): Undefined index: action [CORE/cake/dispatcher.php, line
>> >>> 269]
>> >>> -and-
>> >>> Notice (8): Undefined index: controller [CORE/cake/dispatcher.php,
>> >>> line
>> >>> 121]
>> >>>
>> >>>
>> >>> Thanks.
>> >>> Steve
>> >>>
>> >>> Check out the new CakePHP Questions site http://cakeqs.org and help
>> >>> others
>> >>> with their CakePHP related questions.
>> >>>
>> >>> You received this message because you are subscribed to the Google
>> >>> Groups
>> >>> "CakePHP" group.
>> >>> To post to this group, send email to cake-php@googlegroups.com
>> >>> To unsubscribe from this group, send email to
>> >>> cake-php+unsubscribe@googlegroups.com For more options, visit this
>> >>> group
>> >>> at http://groups.google.com/group/cake-php?hl=en
>> >>
>> >> Check out the new CakePHP Questions site http://cakeqs.org and help
>> >> others
>> >> with their CakePHP related questions.
>> >>
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "CakePHP" group.
>> >> To post to this group, send email to cake-php@googlegroups.com
>> >> To unsubscribe from this group, send email to
>> >> cake-php+unsubscribe@googlegroups.com For more options, visit this
>> >> group at
>> >> http://groups.google.com/group/cake-php?hl=en
>> >>
>> >
>> >
>>
>> Check out the new CakePHP Questions site http://cakeqs.org and help others
>> with their CakePHP related questions.
>>
>> You received this message because you are subscribed to the Google Groups
>> "CakePHP" group.
>> To post to this group, send email to cake-php@googlegroups.com
>> To unsubscribe from this group, send email to
>> cake-php+unsubscribe@googlegroups.com For more options, visit this group
>> at http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

--
Steve Mallett
inevitable.cc (the) Inevitable Corp.

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: