/**
 * Returns <script> tags for all javascripts associated with the given form.
 *
 * The scripts are set by implementing the getJavaScripts() method in the
 * corresponding widget.
 *
 * <code>
 * class MyWidget extends sfWidgetForm
 * {
 *   public function getJavaScripts()
 *   {
 *     return array('/path/to/a/file.js');
 *   }
 * }
 * </code>
 *
 * @return string <script> tags
 */
function get_javascripts_for_form(sfForm $form)
{
    $html = '';
    foreach ($form->getJavascripts() as $file) {
        $html .= javascript_include_tag($file);
    }
    return $html;
}
Exemple #2
0
/**
 * Adds javascripts from the supplied form to the response object.
 *
 * @param sfForm $form
 */
function use_javascripts_for_form(sfForm $form)
{
    $response = sfContext::getInstance()->getResponse();
    foreach ($form->getJavascripts() as $file) {
        $response->addJavascript($file);
    }
}
 public function getJavaScripts()
 {
     $javascripts = parent::getJavascripts();
     $javascripts[] = '/js/catalogue_people.js';
     return $javascripts;
 }
/**
 * Returns <script> tags for all javascripts associated with the given form.
 * @return string <script> tags
 */
function dm_get_javascripts_for_form(sfForm $form)
{
    $html = '';
    foreach ($form->getJavascripts() as $file) {
        $file = sfContext::getInstance()->getResponse()->calculateAssetPath('js', $file);
        $html .= javascript_include_tag($file);
    }
    return $html;
}
 public function getJavascripts()
 {
     return array_merge(parent::getJavascripts(), array('student_attendance.js'));
 }