Welcome Guest, Not a member yet? Register   Sign In
using xajax in button and textfield
#1

[eluser]pandjie[/eluser]
Hi,
I have a problem in using xajax and CI. I have a button and a textfield input. I want a scenario like this : when the button pressed, some text displayed in text field input. I have code like this :

Code:
<?php
    class Formajax Extends Controller {
        function Formajax(){
            parent :: Controller();
            $this->load->library('xajax');
            $this->load->helper('url');
            $this->xajax->registerFunction(array ('process_form',& $this,'process_form'));
            $this->xajax->processRequest();
        }
        
        function process_form($form_data){
            $objResponse = new xajaxResponse();
            $result = "Your name is  panji";
            $name = $form_data['txt_value'];
            
            $objResponse->addAssign($name, "value", $result);
            return $objResponse;
        }
        
        function index(){
            $template['xajax_js'] = $this->xajax->getJavascript(base_url());
            $this->load->view('coba/form',$template);
        }
    }
?>


and HTML code like this :
Code:
<form name="ajaxform" id="ajaxform" onsubmit="return false;">
               <input type="submit" value="submit" onclick="xajax_process_form(xajax.getFormValues('ajaxform'));"/>
          <input type="text" name="txt_value" value="" size="20"/>

  </form>

but, when I pressed the button no text was displayed.
what's wrong ?


Messages In This Thread
using xajax in button and textfield - by El Forum - 04-13-2008, 08:28 PM
using xajax in button and textfield - by El Forum - 04-13-2008, 11:38 PM
using xajax in button and textfield - by El Forum - 04-13-2008, 11:52 PM
using xajax in button and textfield - by El Forum - 04-14-2008, 12:09 AM
using xajax in button and textfield - by El Forum - 04-14-2008, 12:36 AM
using xajax in button and textfield - by El Forum - 04-14-2008, 01:35 AM
using xajax in button and textfield - by El Forum - 04-14-2008, 02:05 AM



Theme © iAndrew 2016 - Forum software by © MyBB