Returns Javascript code for getting the element's value

@return   string
350813
public function getJavascriptValue()
    {
        $args = array();
        foreach ($this as $child) {
            if ($child instanceof HTML_QuickForm2_Container) {
                $args[] = $child->getJavascriptValue();
            } else {
                $args[] = "'" . $child->getId() . "'";
            }
        }
        return 'qf.form.getContainerValue(' . implode(', ', $args) . ')';
    }
437436
protected function getInput()
	{
		$html = array();
		$attr = '';

		// Initialize some field attributes.
		$attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';

		// To avoid user's confusion, readonly="true" should imply disabled="true".
		if ((string) $this->element['readonly'] == 'true' || (string) $this->element['disabled'] == 'true')
		{
			$attr .= ' disabled="disabled"';
		}

		$attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
		$attr .= $this->multiple ? ' multiple="multiple"' : '';

		// Initialize JavaScript field attributes.
		$attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';

		// Get the field options.
		$options = (array) $this->getOptions();

		// Create a read-only list (no name) with a hidden input to store the value.
		if ((string) $this->element['readonly'] == 'true')
		{
			$html[] = HtmlSelect::genericlist($options, '', trim($attr), 'value', 'text', $this->value, $this->id);
			$html[] = '<input type="hidden" name="' . $this->name . '" value="' . $this->value . '"/>';
		}
		else
		// Create a regular list.
		{
			$html[] = HtmlSelect::genericlist($options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
		}

		return implode($html);
	}
1147151
protected function getInput()
	{
		// Initialize some field attributes.
		$class = $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
		$disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
		$value = $this->element['value'] ? (string) $this->element['value'] : '1';

		if (empty($this->value))
		{
			$checked = (isset($this->element['checked'] )) ? ' checked="checked"' : '';
		}
		else
		{
			$checked = ' checked="checked"';
		}

		// Initialize JavaScript field attributes.
		$onclick = $this->element['onclick'] ? ' onclick="' . (string) $this->element['onclick'] . '"' : '';

		return '<input type="checkbox" name="' . $this->name . '" id="' . $this->id . '"' . ' value="'
			. htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '"' . $class . $checked . $disabled . $onclick . ' />';
	}
122443
public function getResponseCode()
    {
        $code = 0;

        $dom = $this->getDOMDocument();
        $xpath = new DOMXPath($dom);
        if (($codeAttribute = $xpath->query('/response/@code')->item(0)) instanceof DOMAttr) {
            $code = intval($codeAttribute->nodeValue);
        }

        return $code;
    }
846074
public function getInputHtml()
    {
        $this->rule->setElementName($this->element->getName());

        if ($this->element->getValue()) {
            /* Hack : reload in a new instance to have element name set.
             *        can not be done in afterLoad of the backend model
             *        since we do not know yet the form structure
             */
            $conditions = $this->element->getValue();
            if (!is_array($conditions)) {
                $conditions = $conditions->getConditions()->asArray();
            }
            $this->rule->getConditions()->loadArray($conditions);
            $this->element->setRule($this->rule);
        }

        $this->input = $this->elementFactory->create('text');
        $this->input->setRule($this->rule)->setRenderer($this->conditions);

        $this->setConditionFormName($this->rule->getConditions(), $this->getElement()->getContainer()->getHtmlId());

        if (is_array($this->getData('url_params'))) {
            $this->setConditionUrlParams($this->rule->getConditions(), $this->getData('url_params'));
        }

        return $this->input->toHtml();
    }
175165
public function getLoginLinkElement()
    {
        $element = $this->getElement($this->_tokenFieldName);

        if (! $element) {
            // Login link
            if ($link = $this->getLoginLink()) {
                $element = new \MUtil_Form_Element_Html($this->_loginLinkFieldName);
                // $element->br();
                $element->setValue($link);

                $this->addElement($element);
            }

            return $element;
        }
    }
820012
protected function getInput() {

        $js = [];

        $class        = $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
        $placeholder  = $this->element['placeholder'] ? ' placeholder="' . htmlspecialchars((string) $this->element['placeholder']) . '"' : null;

        $options = [];

	    if ($this->value) {
	    	$options['initialDate'] = "##FUNC##moment('".$this->value."', 'X')##FUNC##";
	    } elseif ($this->element['initialDate']) {
		    $options['initialDate'] = "##FUNC##moment('".(string) $this->element['initialDate']."', 'X')##FUNC##";
	    }

	    if ($this->element['endDate']) {
		    $options['endDate'] = "##FUNC##moment('". (string) $this->element['endDate']."')##FUNC##";
	    }

	    if ($this->element['onChange']) {
		    $options['onChange'] = "##FUNC##" . (string) $this->element['onChange'] . "##FUNC##";
	    }

	    if ($this->element['valueFormat']) {
		    $options['valueFormat'] = "##FUNC##" . (string) $this->element['valueFormat'] . "##FUNC##";
	    }

	    if ($this->element['showWeekNumber']) {
		    $options['showWeekNumber'] = ((string) $this->element['showWeekNumber'] == "true");
	    }

	    $str = str_replace(['"##FUNC##', '##FUNC##"'], "", json_encode($options));

        $js[] = "var wp = new weekpicker('#" . $this->id . "', " . $str . ");$('#" . $this->id . "').data('weekpicker', wp);";

        (new RequireJSUtility())
            ->addRequireJSModule("moment", "js/vendor/moment.min", true)
            ->addRequireJSModule("weekpicker", "js/vendor/week-picker.min", false, ["jquery", "moment"])
            ->addDomReadyJS(implode("\n", $js), false, "moment, weekpicker, css!/css/vendor/week-picker.min.css", false);

	    $value = $this->value;
	    if (empty($value)) {
	    	$value = time();
	    }

	    return '<div class="input-group week-picker">'
                . '<input type="text" readonly id="' . $this->id . '" value="' . date('\SW Y', $value) . '"' . $placeholder . $class . '>'
                . '<span class="input-group-addon" id="' . $this->id . '_btn"><span class="fa fa-calendar"></span></span>'
             . '</div>';


    }
330876
public function getValue()
    {
        $prettyPrinter = new PrettyPrinter\Standard;
        return trim(
            $prettyPrinter->prettyPrintExpr($this->node->consts[0]->value),
            '"\''
        );
    }
973860
private function getCode()
    {
        $_paq = '';
        foreach ($this->options as $key => $values) {
            foreach ($values as &$value) {
                $value = "'".$value."'";
            }
            $_paq .= sprintf("_paq.push([%s]);\n", implode($values, ','));
        }

        return <<<PWK
<script>
var _paq = _paq || [];
{$_paq}
(function() {
    var u="{$this->piwikUrl}";
    _paq.push(['setSiteId', {$this->siteId}]);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="{$this->piwikUrl}piwik.php?idsite={$this->siteId}" style="border:0;" alt="" /></p></noscript>
PWK;
    }
155415
protected function getInput()
	{
		if (empty($this->value))
		{
			// A color field can't be empty, we default to black. This is the same as the HTML5 spec.
			$this->value = '#000000';
		}

		$this->value = '#' . ltrim($this->value, '#');

		// Initialize some field attributes.
		$attributes = array(
			'type'         => 'text',
			'value'        => htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8'),
			'name'         => $this->name,
			'id'           => $this->id,
			'size'         => ($this->element['size']      ? (int) $this->element['size']      : ''),
			'maxlength'    => ($this->element['maxlength'] ? (int) $this->element['maxlength'] : ''),
			'class'        => ($this->element['class']     ? (string) $this->element['class']  : ''),
			'autocomplete' => ((string) $this->element['autocomplete'] == 'off' ? 'off'      : ''),
			'readonly'     => ((string) $this->element['readonly'] == 'true'    ? 'readonly' : ''),
			'disabled'     => ((string) $this->element['disabled'] == 'true'    ? 'disabled' : ''),
			'onchange'     => ($this->element['onchange']  ? (string) $this->element['onchange'] : '')
		);

		if (!$attributes['disabled'])
		{
			Behavior::colorpicker();

			$attributes['class'] .= ' input-colorpicker';
		}

		$attr = array();
		foreach ($attributes as $key => $val)
		{
			if (!$val)
			{
				continue;
			}
			$attr[] = $key . '="' . $val . '"';
		}

		return '<span class="input-color"><input ' . implode(' ', $attr) . ' /></span>';
	}
1079761
public function getValue()
    {
        if (!empty($this->elements)) {
            $value = [];
            foreach ($this->elements as $el) {
                if ($el->getKey() !== null) {
                    $value[$el->getKey()] = $el->getValue();
                } else {
                    $value[] = $el->getValue();
                }
            }

            return $value;
        } else {
            return $this->value;
        }
    }
128806
public function input() {

		$input = '<label class="switch setting_toggle_alert" data-for="' . esc_attr( $this->id() ) . '-control">';
		$input .= '<input type="checkbox" value="1" ' . $this->build_attributes() . ' data-value="' . esc_attr( $this->get_value() ) . '">';
		$input .= '<span class="toggle-on dashicons ' . esc_attr( $this->icons['on'] ) . '"></span>';
		$input .= '<span class="toggle-off dashicons ' . esc_attr( $this->icons['off'] ) . '"></span>';
		$input .= '<div class="box"></div>';
		$input .= '</label>';

		return $input;
	}
647544
public function val()
    {
        $el = count($this) > 1 ? $this->get(0) : $this;
        switch (strtoupper($el->nodeName(false))) {
            case 'TEXTAREA':
                return $el->html();
            case 'INPUT':
                switch (strtoupper($el->attr('type'))) {
                    case 'CHECKBOX':if ($el->attr('checked') === false) {
                            return false;
                        }

                    default:return $el->attr('value');
                }
                return $el->html();
            case 'SELECT': // ???

            default:return false;
        }
    }
1003918
public function getHTML() {
        $tag = "<" . $this->name;
        $q = $this->quoteType;

        //build attribute strings
        foreach( $this->attrs as $name=>$value ) {
            //if true, such as CHECKED, we just add the name
            if( $value === true ) {
                $tag .= " $name";
            } else if( is_string( $value ) ) { //if it's a string, we add attr="value"
                $tag .= " {$name}={$q}{$value}{$q}";
            }
        }

        //short tag? close it and return
        if( $this->isShortTag ) {
            $tag .= ' />';
            
            return $tag;
        }

        //not a short tag, close it
        $tag .= '>';

        //add the children if they exist
        if( $this->hasChildren() ) {
            foreach( $this->getChildren() as $child ) {
                $tag .= $child->getHTML();
            }
        }

        //closing tag
        $tag .= "</{$this->name}>";

        return $tag;
    }
13628
public function getElementId()
    {
        if ($this->elementId === null) {
            $param = WebDriver_Util::parseLocator($this->locator);
            $commandUri = (null === $this->parent) ? 'element' : "element/{$this->parent->getElementId()}/element";
            $command = $this->driver->factoryCommand($commandUri, WebDriver_Command::METHOD_POST, $param);
            try {
                $result = $this->driver->curl($command);
            } catch (WebDriver_Exception $e) {
                $parentText = (null === $this->parent) ? '' : " (parent: {$this->parent->getLocator()})";
                $e->setMessage("Element not found: {$this->locator}{$parentText}  with error: {$e->getMessage()}");
                throw $e;
            }
            if (!isset($result['value']['ELEMENT'])) {
                $parentText = (null === $this->parent) ? '' : " (parent: {$this->parent->getLocator()})";
                throw new WebDriver_Exception("Element not found: {$this->locator}{$parentText}");
            }
            $this->elementId = $result['value']['ELEMENT'];
        }
        return $this->elementId;
    }
780099
protected function getInput()
	{
		// Initialize some field attributes.
		$class = $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
		$disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
		$columns = $this->element['cols'] ? ' cols="' . (int) $this->element['cols'] . '"' : '';
		$rows = $this->element['rows'] ? ' rows="' . (int) $this->element['rows'] . '"' : '';

		// Initialize JavaScript field attributes.
		$onchange = $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';

		return '<textarea name="' . $this->name . '" id="' . $this->id . '"' . $columns . $rows . $class . $disabled . $onchange . '>'
			. htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '</textarea>';
	}
1120893
protected function getInput()
	{
		// Initialize variables.
		$attr = '';

		// Initialize some field attributes.
		$attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
		$attr .= ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
		$attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
		$attr .= $this->multiple ? ' multiple="multiple"' : '';

		// Initialize JavaScript field attributes.
		$attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';

		// Get the field options.
		$options = $this->getOptions();

		return Access::level($this->name, $this->value, $attr, $options, $this->id);
	}