Welcome Guest, Not a member yet? Register   Sign In
Ajax Framework (CJAX) for Codeigniter 2.x+
#11

[eluser]Ajaxboy[/eluser]
Thanks for bringing that up InsiteFX... the only function that uses ereg (syntax_hilight) is deprecated to favor $ajax->code().. will be removed in next release. Thanks again let me know if you notice anything else.. Sorry I missed to add the @deprecated tag

Ajaxboy
#12

[eluser]Ajaxboy[/eluser]
Update:
New Download Location:
https://sourceforge.net/projects/cjax/files/

-

AJAXFW 4.1RC4 Final Release,

Download
Quote:http://code.google.com/p/ajax-framework-...loads/list
Changes from RC3 to RC4 Final
* Revamped Javascript plugin system to be more precise and efficient

* Fixed bug that could not pharse elements values passed in vertical bars when using friendly urls
and when values were more than one. This section was rewritten.

* Other minor bugs and improvements

* Improved Demos listings and updated some demos

See full ChangeLog:
Quote:http://code.google.com/p/ajax-framework-...NGELOG.txt

This release indicates that we are very close to a 'official' stable release.

New Demos zip *updated*
Download
Quote:http://code.google.com/p/ajax-framework-...ES_1.6.zip
#14

[eluser]Distortion[/eluser]
Hi.. is it possible to set Validation Rules in Response/My_controller ?
Ex. in my response/Account.php.. just don't mind the other Codes..
Code:
class controller_Account extends CI_Controller {

    function login($form_fields){
  $ajax = CJAX::getInstance();
  $this->load->model('account_model');
        
        $this->form_validation->set_rules('email_address', 'Email Address','valid_email|required|xss_clean');
  $this->form_validation->set_rules('password', 'Password', 'required|min_length[1]|max_length[12]|xss_clean');
  $this->_email_address = $form_fields['email_address'];
  $this->_password = $form_fields['password'];
  
  // if the user Enter wrong information Show Validation Errors
  if($this->form_validation->run() == false) {
   // Write Login Logs Error
   $this->logs->write_login(validation_errors());
   $ajax->error(validation_errors(),5);
  }
  else {
                        // Check if the user Account is Exists
   if($this->account_model->login() == true) {
    /* if Registered Go Here.. */
    $this->account_model->set_login_session(); // set Session
                        // Write login logs to ok
    $this->logs->write_login('ok');
                        
          // Redirect User to the page He Viewd
    redirect($this->input->post('return_url'));
   }
   else {
    /* Incorrect Credentials */
                       $ajax->warning('Incorrect Email Address or Password',5);
   }
  }
    }
    
    
}
in my View/Account/login.php
Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?>
<?php

$ajax = CJAX::getInstance();
$ajax->Exec("login",$ajax->form("ajax.php?controller=account&function=login","frmLogin"));

?>
<?php $return_lang = $this->uri->segment(3) ?>
<?php if(!empty($return_lang)): ?>
<h4 id="required">&lt;?php echo $this->lang->line($return_lang) ?&gt;</h4>
&lt;? endif; ?&gt;
<a id='anchor1' href='#'>Anchor 1</a>
<div id="loginContainer">
&lt;form id="frmLogin" method="post" action=""&gt;
&lt;?php
     // Return URL
     echo form_hidden('return_url', $this->uri->uri_string());
?&gt;
<table class="form">
<tr>
    <td id="form_lbl">&lt;?php echo $this->lang->line('lbl_email_address') ?&gt;
    &lt;input type="text" id="a[email_address]" name="a[email_address]"  size="30" value="&lt;?php echo set_value('email_address'); ?&gt;" /&gt;
    </td>
</tr>
<tr>
    <td id="form_lbl">&lt;?php echo $this->lang->line('lbl_password') ?&gt;
    &lt;input  type="password" id="a[password]" name="a[password]" size="30" value="&lt;?php echo set_value('password'); ?&gt;" /&gt;
    </td>
</tr>
</table>
&lt;input type="submit" id="login" name="submit" class="Frmbtn" value="&lt;?php echo $this-&gt;lang-&gt;line('btn_login') ?&gt;" /&gt;
</div>

How to set the Validation Rules.. ?
Thanks in Advance.
#15

[eluser]Ajaxboy[/eluser]
Hello Distortion,

I am thinking I know what your issue is, but I'd like to make sure..
please bear with me. So you want to validate the fields, and it is not validating them, but usually it does when you use regular POST? please confirm if this is the issue
#16

[eluser]Distortion[/eluser]
Yes it is Ajaxboy.. i Wonder if it is Possible to use the Validation rules..
Thanks for the fast Reply.. ^_^
#17

[eluser]Ajaxboy[/eluser]
Yes it is possible, and it is workable on the upcoming release. Some improvements were made on that area the last few days, fortunately for you the stable release will be released by today.
#18

[eluser]Ajaxboy[/eluser]
[h3]New Release[/h3]
Quote:http://code.google.com/p/ajax-framework-...CI_1.6.zip

Changes from 4.1RC3 to 4.2

Quote:* Full support for Cross Domain Ajax
* 2 New samples/demos added. Search, and Cross Domain Request.
* New API table
* Improved demos listings
* Made improvements to ajax form handling and refined form processing params handling
* Other small improvements
* New CJAX+Jquery+Jquery.validate plugin - integration of CJAX with jquery.validate (Sample included in demos)
See full ChangeLog
Quote:http://ajax-framework-for-codeigniter.go...NGELOG.txt

[h3]Upgrade[/h3]
It is recommended to upgrade to this version if you use any other previous version. This version seals the Release candidate (RC) label mark, and this release is considered stable. By upgrading none of your code has to change it is backward compatible. Upgrade by overwriting your previous Cjax installation. Make sure to make a backup of your files, just in case.


2 New demos/samples

Full support for Cross domain ajax request, you may now send ajax request across domains and fetch remote content with the same api you create ajax requests.

Ps:

Distortion,

This release should be able to fix your issue.

#19

[eluser]Ajaxboy[/eluser]
Client Side Validation Plugin with Jquery Integration

CJAX Jquery.validate Plugin
This plugin is an alternative if you already use Jquery, and jquery.validate.
You may now make full use of the jquery.validate plugin, through cjax API, in PHP, Example included in demos zip. This plugin requires for you to load jquery and jquery.validate plugin in your page. This plugin is fully compatible and can be use with other Ajax API such as $ajax->form() and $ajax->call()

Quick Samples

You'd use the exact same format (in PHP) that is used in jquery.validate plugin (JAVASCRIPT) options, that is what makes it easy to use, if you are already familiar with this plugin in jquery.

Code:
$validate = array(
//'errorElement' => 'div'
//'submitHandler' => "function() { alert('no error were found!') }"
//'invalidHandler' => "function() { alert('this is executed  if errors are found..') }"
'rules' => array(
  'a[name]' => array(
   'required' => true,
   'minlength'  => 5,
  ),
  'a[last_name]' => array(
   'required' => true,
   'minlength'  => 5,
  ),
  'a[email]' => array(
   'required' => true,
   'email' => true
  )
),
'messages' => array(
  'a[name]' => array(
   'required' => 'Please enter your name',
  ),
  'a[last_name]' => array(
   'required' => 'Enter your last name',
  ),
  'a[email]' => array(
   'required' => 'Email is required',
  )
  
)
);
$ajax->validate('button_id', $validate);
$ajax->Exec('button_id', $ajax->form('ajax.php?controller/function', 'form_id'));

Review plugin documentation
Quote:http://docs.jquery.com/Plugins/Validation

A working sample is included in the samples/demos zip

Download the Plugin
Quote:http://code.google.com/p/ajax-framework-...te_1.0.zip


Hope that makes sense to anyone that might use the plugin
#20

[eluser]Ajaxboy[/eluser]
[h3]Creating AJAX Framework (4.2+) Plugins[/h3]

This post was moved to the wiki:
Quote:http://codeigniter.com/wiki/Ajax_Framewo...odeIgniter




Theme © iAndrew 2016 - Forum software by © MyBB