Welcome Guest, Not a member yet? Register   Sign In
ajax wih CodeIgniter
#1

[eluser]handoyo[/eluser]
Hi all,i'm trying to create 3 textfield with CI by using form_input. One is for enter price,one is for enter the desire discount value,the last one is for the discounted price which is calculated from price and discount value..How do i achieve it with CI?Thanks a lot..
#2

[eluser]davidbehler[/eluser]
No need for ajax or special CI feature, just use simple [removed])

I have the impression, that people tend to forget about old school coding whenever they hear "...framework..." ^^
#3

[eluser]handoyo[/eluser]
What should i do then?Thanks...
#4

[eluser]davidbehler[/eluser]
Try something along this lines:
Code:
<5cr1pt >
function update_disc_price()
{
  var new_value = $('price').getValue() - $('discount').getValue();
  $('disc_price').setValue(new_value);
}
</5cr1pt >
&lt;input name="price" id="price" value=""&gt;
&lt;input name="discount" id="discount" value=""&gt;
&lt;input name="disc_price" id="price" value="" /&gt;
Be aware, that this example uses the prototype framework and this can be done with "normal" js aswell, but I'm just to lazy to look the functions Wink

My example propably won't work, but you should be able to work with this...I guess.
#5

[eluser]handoyo[/eluser]
How about using form_input?Is it possible to do it too?Thanks waldmeister..
#6

[eluser]umefarooq[/eluser]
yes you can do with form_input here is example

Code:
form_input(array('name'=>'price','id'=>'price','value'=>''));
#7

[eluser]handoyo[/eluser]
Where should i put the function?Is it on the view?Thanks..
#8

[eluser]Zack Kitzmiller[/eluser]
You're _really_ over-complicating this. Just use a little bit of old-fashioned [email protected]
#9

[eluser]handoyo[/eluser]
How to do it with old fashioned javascript?Thanks..




Theme © iAndrew 2016 - Forum software by © MyBB