Monday, August 6, 2012

Re: Crreate invoice form

Dear Sir,

I am thanks a lots for useful help; however, I cannot understand, may you help me with this form and I will send the whole application to you to be easy for you to check.

Or may you are available for chat.

I am looking forward to hearing from you as soon as possible.

Sincerely Yours,
Mr. Manager,

On Mon, Aug 6, 2012 at 1:12 PM, Dominik Gajewski <dominikgajewski1@gmail.com> wrote:
to save something to database you need to create jQuer-AJAX code which
will be sending information via POST method to some PHP code
in cake ther are some helpers, but I can present you how to do without.

for exampe you have button or image which you clicking it should save
your data, let's name it add

<input type="text" id="price_1" name="price" />
<img id="add_1" src="path/to/img" class="btn_add" /> // add_1 is
button add with invoice id 1


<script>
$(document).ready(function(){
   $('.btn_add').click(function(){
     var id = $(this).attr('id').split('_'); //here you get name of
your button and invoice id in js array
    $.ajax({
        "url" : "save_invoice.ajax.php",
        "data" : {"invoice_id": id[1], "price" : $('#price_'+id[1]).val(),
... /* You can add more fields or just serialize form */ },
        "type" : "POST",
        "success" : function(html){
           alert('Data was sent')
        }
        });
   });
});
</script>

And in file which you set in ajax url  write

$id = $_POST['id'];
$price = $_POST['price'];

echo $id; //invoice id
echo $price //price on invoice

It is reall simple case of use jQuery. As I wrote in cake it is
possible to do that little bit different
You can read manual on jQuery.com

2012/8/6 Ly Dara <lydara9@gmail.com>:
> Can use guide me how to use it?
>
>
> On Sun, Aug 5, 2012 at 2:49 PM, Dominik Gajewski
> <dominikgajewski1@gmail.com> wrote:
>>
>> I suggest to use JavaScript (jQuery, ..). It is really easy to solve
>> using jQuery with AJAX.
>>
>>
>> 2012/8/5 Mr. Manager <lydara9@gmail.com>:
>> > Dear All,
>> >
>> > I want to create form input for creating invoice which including two
>> > table
>> > invoice and invoice detail. Invoice detail process when the user type
>> > item
>> > code and click add button I want to update the data show in table on the
>> > form without refreshing page because they user can choose other item
>> > with
>> > the same invoice ID. And so I hope that someone will have solution to
>> > deal
>> > with this one. You can clearly know what I have mentioned by seeing
>> > picture
>> > in attachment file.
>> >
>> > I am looking forward to hearing good new as soon as possible.
>> >
>> > Best Regard,
>> > Mr. Manager,
>> >
>> > --
>> > Our newest site for the community: CakePHP Video Tutorials
>> > http://tv.cakephp.org
>> > Check out the new CakePHP Questions site http://ask.cakephp.org and help
>> > others with their CakePHP related questions.
>> >
>> >
>> > 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
>>
>>
>>
>> --
>> Pozdrawiam
>> Dominik Gajewski
>>
>> --
>> Our newest site for the community: CakePHP Video Tutorials
>> http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help
>> others with their CakePHP related questions.
>>
>>
>> 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
>
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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



--
Pozdrawiam
Dominik Gajewski

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


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

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
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

No comments: