How to create a form that do the sum of two integer input

View: New views
11 Messages — Rating Filter:   Alert me  

How to create a form that do the sum of two integer input

by josephtys86@googlemail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Hi all,
  I need help on how am i able to create a from that accept two input
in a textfield and sum the two inputs and then display the output in a
message box. I has write the code but i don't know where should i
write the sum formula, whether is it in the controller or in the
templates.
Some of my coding, i use from the remote form widget example. Here is
the links to my code.

http://paste.turbogears.org/paste/3079

Thank for teaching me.

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


Re: How to create a form that do the sum of two integer input

by Diez B. Roggisch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


josephtys86@... schrieb:
>
> Hi all,
>   I need help on how am i able to create a from that accept two input
> in a textfield and sum the two inputs and then display the output in a
> message box. I has write the code but i don't know where should i
> write the sum formula, whether is it in the controller or in the
> templates.
> Some of my coding, i use from the remote form widget example. Here is
> the links to my code.

The code goes into the controller.

Diez

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


Re: How to create a form that do the sum of two integer input

by josephtys86@googlemail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


can you tell me where should i write the sum in the controller then.
Please. i try to write sum = num1+num2 but it say that num1 and num2
was not declare.please help me as tomorrow is my deadline

On Jul 6, 7:35 pm, "Diez B. Roggisch" <de...@...> wrote:

> josephty...@... schrieb:
>
>
>
> > Hi all,
> >   I need help on how am i able to create a from that accept two input
> > in a textfield and sum the two inputs and then display the output in a
> > message box. I has write the code but i don't know where should i
> > write the sum formula, whether is it in the controller or in the
> > templates.
> > Some of my coding, i use from the remote form widget example. Here is
> > the links to my code.
>
> The code goes into the controller.
>
> Diez
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to turbogears@...
To unsubscribe from this group, send email to turbogears-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: How to create a form that do the sum of two integer input

by Christoph Zwerschke :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


josephtys86@... schrieb:
> can you tell me where should i write the sum in the controller then.
> Please. i try to write sum = num1+num2 but it say that num1 and num2
> was not declare.please help me as tomorrow is my deadline

Have a look at how you declared your input parameters. They should be
called num1 and num2 if you want to address them with these names.

Also, you should add a validate decorator converting them to integers.
Have a look at http://docs.turbogears.org/1.0/ValidateDecorator

-- Christoph

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


Re: How to create a form that do the sum of two integer input

by josephtys86@googlemail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


what do you mean by " i should called them num and num2? mind to
elaborate. Thank
do you mind to show me the code. please

best regards,
Joseph

On Jul 7, 1:04 am, Christoph Zwerschke <c...@...> wrote:

> josephty...@... schrieb:
>
> > can you tell me where should i write the sum in the controller then.
> > Please. i try to write sum = num1+num2 but it say that num1 and num2
> > was not declare.please help me as tomorrow is my deadline
>
> Have a look at how you declared your input parameters. They should be
> called num1 and num2 if you want to address them with these names.
>
> Also, you should add a validate decorator converting them to integers.
> Have a look athttp://docs.turbogears.org/1.0/ValidateDecorator
>
> -- Christoph
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to turbogears@...
To unsubscribe from this group, send email to turbogears-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: How to create a form that do the sum of two integer input

by josephtys86@googlemail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


i wrote num1= textfield()
           num2 = textfield()

is there a problem?

On Jul 7, 1:18 am, "josephty...@..."
<josephtham...@...> wrote:

> what do you mean by " i should called them num and num2? mind to
> elaborate. Thank
> do you mind to show me the code. please
>
> best regards,
> Joseph
>
> On Jul 7, 1:04 am, Christoph Zwerschke <c...@...> wrote:
>
> > josephty...@... schrieb:
>
> > > can you tell me where should i write the sum in the controller then.
> > > Please. i try to write sum = num1+num2 but it say that num1 and num2
> > > was not declare.please help me as tomorrow is my deadline
>
> > Have a look at how you declared your input parameters. They should be
> > called num1 and num2 if you want to address them with these names.
>
> > Also, you should add a validate decorator converting them to integers.
> > Have a look athttp://docs.turbogears.org/1.0/ValidateDecorator
>
> > -- Christoph
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to turbogears@...
To unsubscribe from this group, send email to turbogears-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: How to create a form that do the sum of two integer input

by Christoph Zwerschke :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


josephtys86@... schrieb:
> i wrote num1= textfield()
>            num2 = textfield()
>
> is there a problem?

No, this is ok, but these are not the input parameters of your
controller. Have a look at the line starting with "def do_total".

-- Christoph


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


Re: How to create a form that do the sum of two integer input

by josephtys86@googlemail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


sir,
 do you mean the sum = num1 = num2 should be put at the def_do_total
line there

On Jul 7, 1:40 am, Christoph Zwerschke <c...@...> wrote:

> josephty...@... schrieb:
>
> > i wrote num1= textfield()
> >            num2 = textfield()
>
> > is there a problem?
>
> No, this is ok, but these are not the input parameters of your
> controller. Have a look at the line starting with "def do_total".
>
> -- Christoph
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to turbogears@...
To unsubscribe from this group, send email to turbogears-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: How to create a form that do the sum of two integer input

by josephtys86@googlemail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


i have no idea which line should i wrote the formula in.

On Jul 7, 1:40 am, Christoph Zwerschke <c...@...> wrote:

> josephty...@... schrieb:
>
> > i wrote num1= textfield()
> >            num2 = textfield()
>
> > is there a problem?
>
> No, this is ok, but these are not the input parameters of your
> controller. Have a look at the line starting with "def do_total".
>
> -- Christoph
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to turbogears@...
To unsubscribe from this group, send email to turbogears-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: How to create a form that do the sum of two integer input

by josephtys86@googlemail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


i don't understand what does the def do_total(self, kw**) do. i copy
this code from the widget browser code example. do you mind to explain
to me. What should i need to do just to make the sum work. Thank for
your guidance

On Jul 7, 1:40 am, Christoph Zwerschke <c...@...> wrote:

> josephty...@... schrieb:
>
> > i wrote num1= textfield()
> >            num2 = textfield()
>
> > is there a problem?
>
> No, this is ok, but these are not the input parameters of your
> controller. Have a look at the line starting with "def do_total".
>
> -- Christoph
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to turbogears@...
To unsubscribe from this group, send email to turbogears-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: How to create a form that do the sum of two integer input

by Christoph Zwerschke :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


josephtys86@... schrieb:
> i don't understand what does the def do_total(self, kw**) do. i copy
> this code from the widget browser code example. do you mind to explain
> to me. What should i need to do just to make the sum work. Thank for
> your guidance

You should read
http://docs.turbogears.org/1.0/GettingStarted/Arguments

-- Christoph

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

LightInTheBox - Buy quality products at wholesale price