<commit_before><?php

namespace Drupal\cediploma\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\HtmlCommand;

/**
 * Custom CeDiploma Form.
 */
class CeDiplomaForm extends FormBase {

  /**
   * {@inheritdoc}
   */
   public function getFormId() {
     return "cediploma_validate";
   }

   /**
    * {@inheritdoc}
    */
   public function buildForm(array $form, FormStateInterface $form_state) {

    $form['cedidtitle'] = [
       '#type' => 'markup',
       '#markup' => '<h1 class="display-title">Credential Validation</h1>',
     ];


     $form['cedid'] = [
       '#type' => 'textfield',
       '#title' => $this->t('Please Enter CeDID (not case sensitive)'),
       '#attributes' => array('data-masked-input' => 'wwww-wwww-wwww', 'data-val' => 'true', 'data-val-regex' => '____-____-____ format required.', 'data-val-regex-pattern' => '(([a-zA-Z0-9]{4})[-]([a-zA-Z0-9]{4})[-]([a-zA-Z0-9]{4}))', 'placeholder' => '____-____-____', 'data-val-required'=> 'The CeDiD field is required.', 'id' => 'CeDiD', 'maxlength' => '14'),
       //'#required' => TRUE,
     ];


    $form['cedidkey'] = [
       '#type' => 'markup',
       '#markup' => '<div class="cedidkey"><img src="/themes/custom/myusf/images/src/cedid_key_image.png"></div>',
     ];



     $form['cename'] = [
       '#type' => 'textfield',
       '#title' => $this->t('First two letters of the name as it appears on the credential'),
       '#attributes' => array( 'maxlength' => '2','placeholder' => '__'),
       //'#attributes' => array('data-masked-input' => '99', 'data-val' => 'true', 'data-val-length' => 'Must be 2 characters.', 'data-val-length-max' => '2', 'data-val-length-min' => '2', 'data-val-required' => 'The UserName field is required.', 'id' => 'UserFirstTwoLetters', 'maxlength' => '2', 'name' => 'UserFirstTwoLetters', 'placeholder' => '__'),
       //'#required' => TRUE,
     ];

     $form['submit'] = [
       '#type' => 'button',
       '#value' => $this->t('Submit'),
       '#ajax' => [
         'callback' => '::setMessage',
       ]
     ];


    $form['cedidtrustlogo'] = [
       '#type' => 'markup',
       '#markup' => '<div class="cedidtrustlogo"><img src="/themes/custom/myusf/images/src/poweredbyCeCredentialTrustLogo_180x34.png"></div>',
     ];


     $form['message'] = [
       '#type' => 'markup',
       '#markup' => '<div class="result_message"></div>'
     ];


     return $form;
   }



  public function validate(array $form, FormStateInterface $form_state) {
  // Validate the postal code is entered when Ireland is not selected.
  if (empty(trim($form_state['values']['cename']))) {
    form_set_error('cename', t('The cename is required.'));
  }
}

<commit_msg>Text change to button html<commit_after><?php

namespace Drupal\cediploma\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\HtmlCommand;

/**
 * Custom CeDiploma Form.
 */
class CeDiplomaForm extends FormBase {

  /**
   * {@inheritdoc}
   */
   public function getFormId() {
     return "cediploma_validate";
   }

   /**
    * {@inheritdoc}
    */
   public function buildForm(array $form, FormStateInterface $form_state) {

    $form['cedidtitle'] = [
       '#type' => 'markup',
       '#markup' => '<h1 class="display-title">Credential Validation</h1>',
     ];


     $form['cedid'] = [
       '#type' => 'textfield',
       '#title' => $this->t('Please Enter CeDID (not case sensitive)'),
       '#attributes' => array('data-masked-input' => 'wwww-wwww-wwww', 'data-val' => 'true', 'data-val-regex' => '____-____-____ format required.', 'data-val-regex-pattern' => '(([a-zA-Z0-9]{4})[-]([a-zA-Z0-9]{4})[-]([a-zA-Z0-9]{4}))', 'placeholder' => '____-____-____', 'data-val-required'=> 'The CeDiD field is required.', 'id' => 'CeDiD', 'maxlength' => '14'),
       //'#required' => TRUE,
     ];


    $form['cedidkey'] = [
       '#type' => 'markup',
       '#markup' => '<div class="cedidkey"><img src="/themes/custom/myusf/images/src/cedid_key_image.png"></div>',
     ];



     $form['cename'] = [
       '#type' => 'textfield',
       '#title' => $this->t('First two letters of the name as it appears on the credential'),
       '#attributes' => array( 'maxlength' => '2','placeholder' => '__'),
       //'#attributes' => array('data-masked-input' => '99', 'data-val' => 'true', 'data-val-length' => 'Must be 2 characters.', 'data-val-length-max' => '2', 'data-val-length-min' => '2', 'data-val-required' => 'The UserName field is required.', 'id' => 'UserFirstTwoLetters', 'maxlength' => '2', 'name' => 'UserFirstTwoLetters', 'placeholder' => '__'),
       //'#required' => TRUE,
     ];

     $form['submit'] = [
       '#type' => 'button',
       '#value' => $this->t('Validate'),
       '#ajax' => [
         'callback' => '::setMessage',
       ]
     ];


    $form['cedidtrustlogo'] = [
       '#type' => 'markup',
       '#markup' => '<div class="cedidtrustlogo"><img src="/themes/custom/myusf/images/src/poweredbyCeCredentialTrustLogo_180x34.png"></div>',
     ];


     $form['message'] = [
       '#type' => 'markup',
       '#markup' => '<div class="result_message"></div>'
     ];


     return $form;
   }



  public function validate(array $form, FormStateInterface $form_state) {
  // Validate the postal code is entered when Ireland is not selected.
  if (empty(trim($form_state['values']['cename']))) {
    form_set_error('cename', t('The cename is required.'));
  }
}


{'fraction_non_alphanumeric': 0.22166156064155704, 'fraction_numerical': 0.009010632546404758, 'mean_word_length': 3.195011337868481, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 111, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5392390', 'n_tokens_mistral': 1959, 'n_tokens_neox': 1932, 'n_words': 352}