⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

"callback_add_field " not support js files



tofayelahmed
  • profile picture
  • Member

Posted 19 April 2012 - 12:02 PM

Hello everybody.

For kind information I'm newbie in Ajax,jquery and javascript.
Recenly i facing a problem when i integrate js files in grocery crud.
At first i describe my needs.Its easy that is the ajax search. i attach the first image(i_want.jpg) which show my needs.
This is my view code.

<html>
<head>
<script type='text/javascript' src='<?php echo base_url();?>js/dynamic.js'></script>
<script type='text/javascript' src='<?php echo base_url();?>js/function_search.js'></script>
<script type="text/javascript" src="<?php echo base_url();?>js/prototype.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>js/effects.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>js/controls.js"></script>
<link rel="stylesheet" href="<?php echo base_url();?>css/ci_functions.css" type="text/css" />
<title>
Search
</title></head>
<body>
<label for="function_name">Search by function name </label>
<input type="text" name="function_name" id="function_name" />
<div id="autocomplete_choices" class="autocomplete"></div>
</body>
</html>


Now i want this(ajax search) is add in grocery crud.
I use "callback_add_field" for this problem.

$this->grocery_crud->callback_add_field('phone',array($this,'add_field_callback_1'));
function add_field_callback_1()
{
return '<input type="text" name="phone" id="phone" />
<div id="autocomplete_choices" class="autocomplete" ></div>';
}


and i link the js file in views.

<script type='text/javascript' src='<?php echo base_url();?>js/dynamic.js'></script>
<script type='text/javascript' src='<?php echo base_url();?>js/function_search.js'></script>
<script type="text/javascript" src="<?php echo base_url();?>js/prototype.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>js/effects.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>js/controls.js"></script>
<link rel="stylesheet" href="<?php echo base_url();?>css/ci_functions.css" type="text/css" />
<?php
foreach($css_files as $file): ?>
<link type="text/css" rel="stylesheet" href="<?php echo $file; ?>" />
<?php endforeach; ?>
<?php foreach($js_files as $file): ?>
<script src="<?php echo $file; ?>"></script>
<?php endforeach; ?>
<style type='text/css'>


But It show error. that is

($(parentElement) || document.body).getElementsByTagName is not a function
[img]chrome://firebug/content/blank.gif[/img]
prototype.js (line 931)

this.element.setAttribute is not a function
[img]chrome://firebug/content/blank.gif[/img]
controls.js (line 81)


Please help me and help.