How to get the bID in validation auto.js in Block

Permalink
Anybody please tell me, how to get the Block Id (bID) in the validation function in auto.js

ccmValidateBlockForm

Thanks,
Bala

 
moosh replied on at Permalink Best Answer Reply
moosh
Hi,

Add this in your block controller :
public function getJavaScriptStrings() {
      return array(
         'bID' => $this->bID
      );
   }


Then in auto.js, you can use :
ccm_t("bID");


++
kumarbalap replied on at Permalink Reply
great.. thx Moosh
jordanlev replied on at Permalink Reply
jordanlev
@moosh's solution is good.
Another way to do it (which isn't better or worse, just a different style) is to declare a javascript variable in the add.php and edit.php files -- it will be available for the auto.js file to use. For example:
<script type="text/javascript">
var bID = <?php echo $bID; ?>;
</script>
kumarbalap replied on at Permalink Reply
yes correct Jordan, I was trying to put it in hidden fields.