Welcome Guest, Not a member yet? Register   Sign In
Two important CJAX questions
#4

[eluser]Ajaxboy[/eluser]
Sorry for the delayed response.

<b>For question #1,</b>

here is a sample, (sorry i didn't have time to do this sooner):

Lets take this existing sample as our model:

http://cjax.sourceforge.net/examples/cli...equest.php

Here are the aspects:

It uses files: examples/click_ajax_request.php, examples/controllers/click_ajax_request.php

in the controller, I did this after adding div1 in the html:
Code:
class controller_click_ajax_request {

function click_button($message)
{
  $ajax = ajax();

  $ajax->update("div1","&lt;input type='button' value='ButtonB' id='buttonb'&gt;");

  $ajax->click('buttonb', $ajax->alert('Hello!'));
  
}
}

It simply adds html to the div, will create a new button, called ButtonB, and when you click buttonb, it will alert "Hello!", like wise you can add any (and as many as you want) other cjax function instead of the alert. This is a basic example, you should be able to add any commands to your newly created elements.

There is a a different "callback" way to accomplish that will be allowed in newer version, by using the plugins technology but it hasn't been tested for this specific purpose so it might need work to work for this purpose, (currently is used to allow the execution of other plugins and other plugins methods).

<b>Question #2</b>

If you look in the example plugin uploader ( http://cjax.sourceforge.net/examples/plu...loader.php )



Code:
$uploader = $ajax->uploader('btn_saveForm', null,
//settings are optional
array(
  'url' => 'ajax.php?upload_file/post', //post request after files are uploaded
  'suffix' => md5(time(). rand(1,10000000)), // makes files names universally unique,
  'debug' => 'Debug Option is turned on this Demo.',
  'success_message' => 'File(s) @files successfully uploaded.', //@files tag is replaced by files uploaded.
  'ext' => array('jpg','gif', 'png','jpeg'),
  'no_files' => 'Please select a file'
)
);

Just comment out 'no_files', and it should not display the warning message when no files are chosen.

Regards,

Cj





Messages In This Thread
Two important CJAX questions - by El Forum - 06-16-2013, 09:55 AM
Two important CJAX questions - by El Forum - 06-19-2013, 04:32 AM
Two important CJAX questions - by El Forum - 06-20-2013, 12:09 AM
Two important CJAX questions - by El Forum - 07-01-2013, 06:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB