mobile – View form errors on a small screen. Scroll to the error vs error button by submitting

I am working on improving the visibility of errors on our form. We display the errors next to the field and highlight the tab containing the errors. Which works well on desktop computers above a certain resolution. But on laptops or small laptops, errors are not always visible.

This screen capture below the form contains errors but is visible only during scrolling.

Mobile view

mobile view


Real page

enter the description of the image here

Should I display errors next to the Save / Send button or scroll to the area / tab that needs to be corrected?

jquery – Error while submitting the form, get an error in the validator Laravel

I have the following error, I try to send a form that also contains an image with ajax, I send it normally but it gives me a 500 error when I'm 39: form submission and validation not yet enter the description of the image hereI know why.
This is my Ajax.

 $('#btn_enviar').click(function (e) {
        e.preventDefault();
        $(this).html('Sending..');
        var url = $(this).data('uri');

        $.ajaxSetup({
          headers: {
              'X-CSRF-TOKEN': $('meta(name="csrf-token")').attr('content')
          }
        });

        $.ajax({
          data: $('#profesor').serialize(),
          url: url,
          type: "POST",
          success: function (data) {
            alert("recibido");

          },
          error: function (data) {
              //console.log('Error:', data);
              alert("error");
              $('#btn_enviar').html('Save Changes');
          }
      });
    });

That's my road
Route :: POST ('SuperAdmin / StoreProfesor', 'ProfessorController @ store') -> name ('SuperAdmin.StoreProfesor');

And my controller with his validation

$json = $request->input('profesor',null);
        $params_array = json_decode($json,true);
        $params = json_decode($json);


       if (!empty($params_array)) {
            $validator = Validator::make($request, (
                'nombre'          =>      'required|alpha',
                'ap_p'            =>      'required|alpha',
                'ap_m'            =>      'required|alpha',
                'direccion'       =>      'required|alpha',
                'image'           =>      'mimes:jpeg,jpg,png'
            ));


            if ($validacion->fails()) {

                $data = array(
                    'status'    => 'error',
                    'code'      =>  404,
                    'mensaje'   =>  'El profesor no se a registrado correctamente',
                    'errors'    =>  $validacion->errors()

                );

            }else {


               $file = $request->file();

                $name=$file->getClientOriginalName();

                Storage::disk('public')->put($name,File::get($file));

                $profesor = new profesor();
                $profesor->nombre = $params_array('nombre');
                $profesor->apellido_p = $params_array('ap_p');
                $profesor->apellido_m = $params_array('ap_m');
                $profesor->direccion = $params_array('direccion');
                $profesor->url_foto = $name;
                $profesor->save(); 

If I enter my controller but it gives me an error, I do not know how to solve it.

refreshing personalized search when submitting and not giving results

The custom search is refreshed during submission and also gives no results. I do not know what's wrong with the code, but if anyone could look at it to help me see what I missed, I would certainly appreciate it. Thank you in advance.

front-page.php

EJES ESTRATÉGICOS

1

DESAROLLO INTEGRAL DE TALENTO

2

APOYO AL BEISBOL INFANTIL Y JUVENIL

3

IMPULSO DE CONCEPTO "BEISBOL" EN MÉXICO

'ranking', 'hide_empty' => false, ) ); ?>

Ranking name; ?>

Ranking Selecciona tu estado
    $v ) { echo '
  • ' . $v . '
  • '; } ?>

scripts.js

/*ranking filter select*/
  $(".filters-select").on("change", function() {
    ranking();
  });

  /*ranking filter search*/
  var ts = $(".quicksearch").val();
  $(".quicksearch").attr("data-search", ts);
  $(".quicksearch").keyup(function(e) {
    var ts = $(this).val();
    $(".quicksearch").attr("data-search", ts);
    ranking();
  });

  $(".filters-ranking .players-state").mCustomScrollbar({
    scrollButtons: { enable: true }
  });
  $(".players-state li").click(function() {
    var val = $(this).attr("data-value");
    $(".players-state").attr("data-state", val);
    ranking();
  });

  /*for first load*/
  function ranking() {
    $(".filters-ranking .players-results").mCustomScrollbar("destroy");
    var position = $(".filters-select option:selected").val();
    var ranking = $(".s-raking .title-bar").attr("data-ranking");
    var search = $(".quicksearch").attr("data-search");
    var state = $(".players-state").attr("data-state");

    $.ajax({
      url: ajaxurl,
      type: "post",
      data: {
        action: "players",
        position: position,
        ranking: ranking,
        search: search,
        state: state
      },
      success: function(response) {
        $("#ajax-content").html(response);
        $(".filters-ranking .players-results").mCustomScrollbar({
          scrollButtons: { enable: true }
        });
      }
    });

    $.ajax({
      url: ajaxurl,
      type: "post",
      data: {
        action: "playersmain",
        position: position,
        ranking: ranking,
        search: search,
        state: state
      },
      success: function(response) {
        $(".ajax-content2").html(response);
      }
    });
  }
  ranking();

  /*ranking filter select MLB*/
  $(".filters-select-MLB").on("change", function() {
    ranking2();
  });
  function ranking2() {
    $(".ranking-wrap .players-results").mCustomScrollbar("destroy");
    var position = $(".filters-select-MLB option:selected").val();

    $.ajax({
      url: ajaxurl,
      type: "post",
      data: {
        action: "playersMLB",
        position: position
      },
      success: function(response) {
        $("#ajax-content-MLB").html(response);
        $(".ranking-wrap .players-results").mCustomScrollbar({
          scrollButtons: { enable: true }
        });
      }
    });
  }
  ranking2();

functions.php

add_action( 'wp_ajax_nopriv_players', 'players' );
add_action( 'wp_ajax_players', 'players' );
function players() {

    $position = $_POST('position');
    $ranking = $_POST('ranking');
    $search = $_POST('search');
    $state = $_POST('state');

    $args = array(
        'post_type'  => 'players_lpm',
        'posts_per_page' => -1,
        's' => $search,
        'tax_query' => array(
            array(
                'taxonomy' => 'ranking',
                'field'    => 'slug',
                'terms'    => $ranking
            )
        ),
        'meta_query' => array(
        array( 'key' => 'position', 'value' => $position, 'compare' => 'LIKE' ),
        array( 'key' => 'state', 'value' => $state, 'compare' => 'LIKE' ),
        'relation' => 'AND'
        )
    );

    $the_query = new WP_Query( $args ); $i2 = '1';
    echo '
    '; while ($the_query -> have_posts()) : $the_query -> the_post(); echo '
  • '.$i2.''.get_the_title().'
  • '; $i2++; endwhile; wp_reset_postdata(); echo '
'; die(); } add_action( 'wp_ajax_nopriv_playersmain', 'playersmain' ); add_action( 'wp_ajax_playersmain', 'playersmain' ); function playersmain() { $position = $_POST('position'); $ranking = $_POST('ranking'); $search = $_POST('search'); $state = $_POST('state'); $args = array( 'post_type' => 'players_lpm', 'posts_per_page' => -1, 's' => $search, 'tax_query' => array( array( 'taxonomy' => 'ranking', 'field' => 'slug', 'terms' => $ranking ) ), 'meta_query' => array( array( 'key' => 'position', 'value' => $position, 'compare' => 'LIKE' ), array( 'key' => 'state', 'value' => $state, 'compare' => 'LIKE' ), 'relation' => 'AND' ) ); $the_query = new WP_Query( $args ); $i2 = '1'; while ($the_query -> have_posts()) : $the_query -> the_post(); echo '
  • '.$i2.''.get_the_title().'
  • '; $i2++; endwhile; wp_reset_postdata(); die(); }

    The site is https://probeis.mx and the search field is visible in the following image:
    enter the description of the image here

    javascript – Execute the function before submitting the form

    I'd like to run a function before submitting a form, but apparently it never runs. Is it possible to run it before sending without using attributes such as onsubmit="return funcion()" or send it with ajax?

    HTML form

             
    

    Code JS

            let form = document.querySelector('.form-search')
                form.addEventListener('submit', (e) => {
                  e.preventDefault()
                  console.log('submit')
                  //función a ejecutar antes de enviar
                  saveSearch(input.value)
            })
    

    400 incorrect queries when submitting the form with AJAX

    I am poor in AJAX and I try to submit the form and insert the record in the custom table for a few days, but I can not get it working.

    I'm getting a 400 Bad Query error on the console. Please have a look at the code.

    In fact, I've tried several ways to submit data, but none of them
    works.

    HTML

    function gs_enqueue_ajax_scripts()
    {
    
        wp_register_script('gs-ajax', GROUP_SHOP_ROOT . 'public/js/add-to-cart-ajax.js', ('jquery'), 1.0, TRUE);
        wp_localize_script('gs-ajax', 'ajax_vars', (
            'ajax_url' => admin_url('admin-ajax.php'),
            'nonce'    => wp_create_nonce('gs_nonce'),
        ));
        wp_enqueue_script('gs-ajax');
    
    }
    
    add_action('wp_enqueue_scripts', 'gs_enqueue_ajax_scripts');
    

    WordPress Hooks – Edit and insert data

    function gs_add_to_cart_ajax()
    {
    
        check_ajax_referer('gs_nonce', $_POST( 'nonce' ), FALSE);
    
        // validating stuffs ..
    
        $cart = new Group_Shop_Cart();
        $cart->add_to_cart($_POST( 'group_id' ), $_POST( 'product' ), $_POST( 'qty' ), $_POST( 'product_option' ));
    
        wp_die();
    }
    
    add_action('wp_ajax_gs_add_to_cart_ajax', 'gs_add_to_cart_ajax');
    add_action('wp_ajax_nopriv_gs_add_to_cart_ajax', 'gs_add_to_cart_ajax');
    
    (function ($) {
    
        $(document).on("click", ".add-to-cart-button", function () {
    
            let data = JSON.stringify({
                action: 'gs_add_to_cart_ajax',
                group_id: $('#group_id').val(),
                product: $('#product').val(),
                qty: $('#qty').val(),
                product_option: $('#product_option').val(),
            });
    
            $('form.addtocartform').on('submit', function (e) {
                e.preventDefault();
    
                $.ajax({
    
                    method: 'POST',
                    dataType: 'json',
                    nonce: ajax_vars.nonce,
                    url: ajax_vars.ajax_url,
                    data: data,
                    success: function (response) {
                        alert("Success");
                    }
    
                });
            });
    
        });
    
    })(jQuery);
    

    I have no idea what's wrong with this code than not to submit.

    custom publication types – Change the term according to the value of a $ variable with the help of wp_update_post when submitting a form

    Context

    • I use a form with facade to submit data to a meta-box using the
      wp_update_post on a custom publication type (call) with a custom taxonomy (type of call).
    • He then also updated the terms and taxonomy of the publication.
    • The code works 100% for this.

    Here is the work code

    //update post
        $post_id = wp_update_post($post_information);
        if($post_id)
        {
            // Update Custom Meta
            update_post_meta($post_id, '_call_16', $_POST('call_16'));
            update_post_meta($post_id, '_call_17', $_POST('call_17'));
            update_post_meta($post_id, '_call_18', $_POST('call_18'));
            update_post_meta($post_id, '_call_19', $_POST('call_19'));
            // Update Custom Meta
            update_post_meta($post_id, '_call_20', $_POST('call_20'));
            // Update call "terms" or taxonomy
            $term_ids = array( 3, 14 );
            $taxonomy = 'call-type';
            wp_set_object_terms( $post_id, $term_ids, $taxonomy );
            // Redirect
            wp_redirect( '$url' );
    
    }
    ?> 
    

    HTML from

    ...
    
    ...

    The problem

    I would like the code to update the termbase to a value of the submitted entry.

    The desired result is.

    • If $ _POST (& # 39; call_16 & # 39;) = No change the term into 18.
    • If $ _POST (& # 39; call_16 & # 39;) = Yes change the term into 14.

    The code I've tried

    //update post
        $post_id = wp_update_post($post_information);
        if($post_id)
        {
            // Update Custom Meta
            update_post_meta($post_id, '_call_16', $_POST('call_16'));
            update_post_meta($post_id, '_call_17', $_POST('call_17'));
            update_post_meta($post_id, '_call_18', $_POST('call_18'));
            update_post_meta($post_id, '_call_19', $_POST('call_19'));
            // Update call terms or taxonomy
            if (isset($_POST('call_16')) == 'No' ) {
                $term_ids = array( 3, 18 );
                $taxonomy = 'call-type';
                wp_set_object_terms( $post_id, $term_ids, $taxonomy );
                // Redirect
                wp_redirect( '$url2' );
            }
            else {
                $term_ids = array( 3, 14 );
                $taxonomy = 'call-type';
                wp_set_object_terms( $post_id, $term_ids, $taxonomy );
                // Redirect
                wp_redirect( '$url' );
            }
        }
    ?>
    

    Anyone can he advise if it is possible and how to do it in detail please.

    .

    How to post a success message after submitting the form?

    In my current Laravel app, all you have to do is fill out a form. So, after submission, nothing happens.

    So now, I wonder how it would be better to post the success message and I thought about it in three different ways:

    1. Just redirect with a success message (where the user can view the data that he just sent)

    2. to display a new complete page with the success message says -only

    3. show a modal (which seems to me the worst)

    After submitting the form, nothing else happens;
    I do not know what is the best solution or if one of them has advantages or disadvantages compared to others.
    Maybe you have another better idea?

    json rpc – Why am I receiving an Auth error when submitting rpc credentials on the command line?

    Direct entry of RPC credentials fails, as follows:

    herbert@Spencer:~/bitcoin-0.18.0/bin$ ./bitcoin-cli -testnet -rpcconnect=127.0.0.1 -rpcuser=x -rpcpassword=p getblockchaininfo
    error: Authorization failed: Incorrect rpcuser or rpcpassword

    while picking them up succeeds indirectly:

    herbert@Spencer:~/bitcoin-0.18.0/bin$ ./bitcoin-cli -conf=/home/herbert/.bitcoin/bitcoin.conf -datadir=/home/herbert/.bitcoin getblockchaininfo
    {
      "chain": "test",
      "blocks": 1576504,
      "headers": 1576504,
      "bestblockhash": "00000000318a0aa170e250d72d2973b4af97812c2c2704a457ce2e7bcbb8c8df",
    ...

    The .conf file is minimal:

    testnet=1
    
    server=1
    
    rpcusername=x
    
    rpcpassword=p

    it is definitely in the right place – hence the fact that Bitcoin works in testnet mode.

    journals – Should I report minor writing errors that I have noticed after submitting the revised version?

    I received a letter of decision from the editor on my document. "I am ready to accept this manuscript for publication, provided that the authors make certain modifications to improve the grammar in the document".
    After submitting the revised version, I noticed some minor corrections to make regarding post-revision write errors (one sentence was written twice and some punctuation errors). Should I approach them now or wait for the editing phase?