Example usage for com.google.gwt.query.client GQuery val

List of usage examples for com.google.gwt.query.client GQuery val

Introduction

In this page you can find the example usage for com.google.gwt.query.client GQuery val.

Prototype

public String val() 

Source Link

Document

Gets the content of the value attribute of the first matched element, returns only the first value even if it is a multivalued element.

Usage

From source file:com.arcbees.website.client.application.contactform.ContactFormView.java

License:Apache License

private boolean validateRequired(Element... elements) {
    boolean valid = true;
    for (Element element : elements) {
        GQuery $element = $(element);
        boolean isEmpty = Strings.isNullOrEmpty($element.val());

        if (isEmpty) {
            addError($element);/*w  w  w . j  ava 2 s . c om*/
        }

        valid &= !isEmpty;
    }

    return valid;
}

From source file:com.jci.client.application.contact.ContactPageView.java

License:Apache License

private void validateAll() {
    valid = true;/*from w  w  w  .j  a  v  a2  s.co m*/

    GQuery name = $("input[id='name']", form);
    validateAllE(name);
    GQuery email = $("input[id='email']", form);
    validateAllE(email);
    GQuery subject = $("input[id='subject']", form);
    validateAllE(subject);
    GQuery message = $("textarea[id='message']", form);
    validateAllE(message);
    validateEmailE(email);

    if (valid) {
        ContactMessage contactMessage = new ContactMessage();

        contactMessage.setEmail(email.val());
        contactMessage.setMessage(message.val());
        contactMessage.setSubject(subject.val());
        contactMessage.setName(name.val());

        $(loader).show();
        getUiHandlers().contact(contactMessage);
    }

    valid = false;
}

From source file:org.bonitasoft.web.toolkit.client.ui.component.table.Table.java

License:Open Source License

private void processEvent(final GQuery cb) {
    final GQuery labels = cb.closest("div").children("label");
    String itemId = cb.val();
    if (cb.is(":checked")) {
        onCheckItem(labels, itemId);//from  ww w  .  j  a v  a  2 s.co m
    } else {
        onUncheckItem(labels, itemId);
    }

    // Check all if no checkbox unchecked
    final boolean noCheckboxCheched = $(".td_checkboxes input", Table.this.getElement()).filter(":checked")
            .length() == $(".td_checkboxes input", Table.this.getElement()).length();
    if (noCheckboxCheched) {
        setCheckAllCheckboxesValue($(".th_checkboxes input", Table.this.getElement()), true);
    } else {
        setCheckAllCheckboxesValue($(".th_checkboxes input", Table.this.getElement()), false);
    }

    // Set datatable class to to inform about selected or not
    if ($(".td_checkboxes input", Table.this.getElement()).filter(":checked").length() > 0) {
        $(getElement()).addClass("linechecked");
        enableActionsLinks();
    } else {
        $(getElement()).removeClass("linechecked");
        disableActionLinks();
    }
}