Examples of FormElement


Examples of org.jsoup.nodes.FormElement

     * Test fetching a form, and submitting it with a file attached.
     */
    @Test
    public void postHtmlFile() throws IOException {
        Document index = Jsoup.connect("http://direct.infohound.net/tidy/").get();
        FormElement form = index.select("[name=tidy]").forms().get(0);
        Connection post = form.submit();

        File uploadFile = ParseTest.getFile("/htmltests/google-ipod.html");
        FileInputStream stream = new FileInputStream(uploadFile);

        // todo: need to add a better way to get an existing data field
View Full Code Here

Examples of org.olat.core.gui.formelements.FormElement

   */
  public void setAllFormElements(boolean readOnly) {
    Iterator it_formelemnames = getNameIterator();
    while (it_formelemnames.hasNext()) {
      String name = (String) it_formelemnames.next();
      FormElement fe = getFormElement(name);
      fe.setReadOnly(readOnly);
    }
  }
View Full Code Here

Examples of org.olat.core.gui.formelements.FormElement

      Map recMap = null;
      Iterator it_formelemnames = getNameIterator();
      while (it_formelemnames.hasNext()) {
        String name = (String) it_formelemnames.next();
        String[] values = ureq.getHttpReq().getParameterValues(name);
        FormElement fe = getFormElement(name);
        fe.clearError(); // clear any previous errors
        if (!fe.isReadOnly()) {
          fe.setValues(values);
        }
      }

      // get selected submit key
      Set parameters = ureq.getParameterSet();
View Full Code Here

Examples of org.olat.core.gui.formelements.FormElement

    renderFormHeader(f, formElementsSO, ubu, renderer.getGlobalSettings().getAjaxFlags());   
   
    Iterator it_names = f.getNameIterator();
    while (it_names.hasNext()) {
      String name = (String) it_names.next();
      FormElement fe = f.getFormElement(name);
      if (fe.isError()) {
        error = true;
      }
      renderFormElement(f, fe, formElementsSO, translator, ubu, args);
    }
View Full Code Here

Examples of org.olat.core.gui.formelements.FormElement

   */
  public void renderBodyOnLoadJSFunctionCall(Renderer renderer, StringOutput sb, Component source, RenderingState rstate) {
    StringBuffer tmp = new StringBuffer();
    Form f = (Form) source;
    String foName = f.getComponentName();
    FormElement focusElem = null, mandatoryElem = null, firstElem = null;
    // PRE: f.isVisible() ensured by renderer
    if (!f.isValid() && !f.isDisplayOnly()) {
      // focus on first error, or on the first element if there is no error
      Iterator it_formelemnames = f.getNameIterator();
      while (it_formelemnames.hasNext()) { // guaranteed correct order since
                                            // linkedhashmap
        String name = (String) it_formelemnames.next();
        FormElement fe = f.getFormElement(name);
        if (!fe.isReadOnly()) {
          if (firstElem == null) firstElem = fe;
          if (fe.isError()) {
            focusElem = fe;
            break;
          } else if (fe.isMandatory()) {
            if (mandatoryElem == null) mandatoryElem = fe; // focus first
                                                            // mandatory element
          }
        }
      }
View Full Code Here

Examples of org.olat.core.gui.formelements.FormElement

  private void renderElementVisibilityDependencyRules(Form f, StringOutput sb) {
    List rules = f.getVisibilityDependsOnSelectionRules();
    Iterator iter = rules.iterator();
    while (iter.hasNext()) {
      VisibilityDependsOnSelectionRule rule = (VisibilityDependsOnSelectionRule) iter.next();
      FormElement dependentElement = rule.getDependentElement();
      SelectionElement selection = rule.getSelectionElement();
      String resetValueOrig = rule.getResetValue();
      String resetValue = null;
      if (resetValueOrig != null) {
        // quote return caracters to fill into js variable
        resetValue = resetValueOrig.replaceAll("\n", "\\\\n");
        resetValue = resetValue.replaceAll("\r", "\\\\n");
      }
      sb.append("b_form_updateFormElementVisibility('")
      .append(f.getComponentName())
      .append("','")
      .append(selection.getName())
      .append("','")
      .append(dependentElement.getName())
      .append("','")
      .append(rule.getVisibilityRuleValue())
      .append("',")
      .append(String.valueOf(rule.isVisibilityRuleResult()))
      .append(",\"")
View Full Code Here

Examples of org.olat.core.gui.formelements.FormElement

        String login = searchform.getTextElement("login").getValue();
        // build user fields search map
        Map<String, String> userPropertiesSearch = new HashMap<String, String>();       
        for (UserPropertyHandler userPropertyHandler : searchform.userPropertyHandlers) {
          if (userPropertyHandler == null) continue;
          FormElement ui = searchform.getFormElement(userPropertyHandler.getName());
          String uiValue = userPropertyHandler.getStringValue(ui);
          if (StringHelper.containsNonWhitespace(uiValue)) {
            userPropertiesSearch.put(userPropertyHandler.getName(), uiValue);
          }
        }
View Full Code Here

Examples of org.olat.core.gui.formelements.FormElement

    UserManager um = UserManager.getInstance();
    userPropertyHandlers = um.getUserPropertyHandlersFor(formIdentifyer, isAdmin);
    // Add all available user fields to this form
    for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
      if (userPropertyHandler == null) continue;
      FormElement ui = userPropertyHandler.getFormElement(getLocale(), null, formIdentifyer, false);
      addFormElement(userPropertyHandler.getName(), ui);
    }
   
    addSubmitKey("submit.search", "submit");
    if (cancelbutton) setCancelKey("submit.cancel");
View Full Code Here

Examples of org.olat.core.gui.formelements.FormElement

    // override for admins
    if (isAdmin) return true;
   
    boolean filled = !getTextElement("login").isEmpty();
    StringBuffer  full = new StringBuffer(getTextElement("login").getValue().trim())
    FormElement lastFormElement = getFormElement("login");
   
    // DO NOT validate each user field => see OLAT-3324
    // this are custom fields in a Search Form
    // the same validation logic can not be applied
    // i.e. email must be searchable and not about getting an error like
    // "this e-mail exists already"
    for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
      FormElement ui = getFormElement(userPropertyHandler.getName());
        String uiValue = userPropertyHandler.getStringValue(ui);
        // add value for later non-empty search check
        if (StringHelper.containsNonWhitespace(uiValue)) {
          full.append(uiValue.trim());
          filled = true;
View Full Code Here

Examples of org.olat.core.gui.formelements.FormElement

    // get user fields from form
    // build user fields search map
    Map<String, String> userPropertiesSearch = new HashMap<String, String>();
    for (UserPropertyHandler userPropertyHandler : searchform.userPropertyHandlers) {
      if (userPropertyHandler == null) continue;
      FormElement ui = searchform.getFormElement(userPropertyHandler.getName());
      String uiValue = userPropertyHandler.getStringValue(ui);
      if (StringHelper.containsNonWhitespace(uiValue)) {
        userPropertiesSearch.put(userPropertyHandler.getName(), uiValue);
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.