creating a Yii calculator -


I'm new to Yii and MVC, and I'm still trying to extract things.

I'm trying to make a calculator in Yii, below is my file directory for my calculator module.

Enter now in my <strong> DefaultController.php </ strong> </ p> <Pre> <code> <php class> Default Controller Controller {Enhances Public Functions () {Return Array ('Page' => Array ('Square' => Seavuction);) Public Function Action Index () {$ this-> Render ('index');} Public Function Execution Collector () {/ * Credit calculation goes here ?? </ code> </ pre> <p> And my <Strong> Calculator module.php </ strong> </ p> <pre> <code> and <? Php C Calculate the CWebModule in the calculator module {public function init ()} // This method is called when module is being created / you can apply code here to customize module / module // module- Level models and components import $ $ this-> setImport (array ('calculator. Models. *', 'Calculator.com. *', ')); $ Model = new calculatorform ();} before public event Controller action ($ controller, $ number Or) {if (parent :: Before the controller action ($ controller, $ action)) {// this method is to perform a module controller is called before / / You can customized code. ; } And false return; }} </ Code> </ pre> <p> This is my <strong> loan-calculator. Php </ strong> </ p> <pre> <code> <lt; div class = true, 'client option' = & Gt; array ('validateOnSubmit' = & gt; true; 'validate on chain' => true;))); ? & Gt; & Lt ;? Php echo $ form-> ErrorModer ($ Models); ? & Gt; & Lt; div class = "form-group" & gt; & Lt ;? Php echo $ form- & gt; Label x ($ model, 'value'); ? & Gt; & Lt ;? Php echo $ form-> TextField ($ model, 'value', array ('class' => form-control')); ? & Gt; & Lt; / Div & gt; & Lt; div class = "form-group" & gt; & Lt ;? Php echo $ form- & gt; Label x ($ model, 'downpayment'); ? & Gt; & Lt ;? Php echo $ form-> TextField ($ model, 'downpayment', array ('class' => form-control)); ? & Gt; & Lt; / Div & gt; & Lt; div class = "form-group" & gt; & Lt ;? Php echo CHtml :: submitButton ('Submit', array ('class' = & gt; 'BTN BTN-LG BTN-Primary BTN-Block')); ? & Gt; & Lt; / Div & gt; & Lt ;? Php $ this- & gt; Endvijet (); ? & Gt; & Lt; / Div & gt; & Lt ;! - form - & gt; & Lt ;? Php endif; ? & Gt; & Lt; / Div & gt;

In my model / calculatorform.fp folder, I have this

    

By using AJAX, how do I get input from my debt-calculator.php and calculate it in the backend and return result to loan-calculator .php

I know I can use javascript, but I do not want to share my calculation formula.

Second, when I

advance

Use ajaxSubmitButton :

< / P>

You can use it to send form data in your action, and then posting a few results back, you can experiment with javascript.

Something like this should look like:

   'function' (data) {// 'data' will be the production of the loan, clone operator} },)); ? & Gt;    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -