2013 – How to listen for an Infopath submit dialog in Sharepoint using Javascript

I know I shouldn’t be using Infopath. I don’t have a choice. We’re not in a new Sharepoint environment yet and we don’t have PowerApps yet. It will happen and we’ll have to redo all of this but we need Infopath in the meantime.

I created an infopath form attached to a form library because the user wanted to be able to add multiple attachments and that wasn’t possible with the list form. We needed to add custom scripting behavior to the form submit page but we couldn’t edit the existing form submit page that Sharepoint creates by default for the library so we created a new page and added the form and a script editor webpart for the Javascript.

My user wants the form to go to the list when she pushes the save button. Its set to close in infopath but currently it does nothing, the form just sits there. I have some say over what is in the query string and I heard that if you put Source= that the submit button will take you to the source URL when the submit is done but I’m not sure that’s going to work for my page. I haven’t tested it yet.

What I need to know is, using Javascript, how do I listen for positive confirmation that an infopath form successfully submitted to a Sharepoint library? In case I need to write a script to do this.

Please I know this is all an ugly hack but its what I have to work with. My tools are Javascript, Sharepoint (and only the front end) and Infopath.

hooks – Alter Submit button of specific form

I am new to Drupal and want to alter a submit button of a node-edit form.
So I wrote a basic module to do so. And it also alters the form button of my form with the id=node_hotel_edit_form. But also it alters all submit buttons to the same text an classes, even in the backend.

My alter_hotel_form.info.yml

name: 'Alter Hotel Form'
type: module
description: 'Alters Hotel EDIT form'
core_version_requirement: ^8 || ^9
package: 'Custom'

My alter_hotel_form.module

<?php

function alter_hotel_form_form_alter(&$form, &$form_state, $form_id) {
  
  if ($form_id = 'node_hotel_edit_form') {
    $form('actions')('submit')('#attributes')('class')() = 'hotel-edit-submit btn btn-medium blue darken-2';
    $form('actions')('submit')('#value') = t('Save Hotel');

  }

}

Can anybody point me a direction or tell me what I am doing wrong?
Thank you very much in advance!

japan – Forgot to submit Record of Purchase card at Narita

Last time I went on holiday to Japan, I bought some souvenirs and took advantage of the Tax-Free exception for tourists. I knew the procedure to follow regarding the paperwork, so as instructed, I planned to leave the Record of Purchase card at the airport before leaving the country. However, once at Narita, due to a set of reasons, I totally forgot about it, and by the time I realised of my mistake, I was mid flight.

All the purchases that I made were legit, and the amount of money that they discounted was minimal (around 2000 yen). My question is: if in the future I go back to Japan, will there be any issue about this when entering/leaving the country (like having to pay a fine or being questioned by customs)?

How do I add both a base domain and a subdomain to Google Search Console and submit an XML sitemap for each?

The best way is the one you mentioned in point 2.

You will have to add two separate properties in your search console

  1. http://example.com
  2. http://subdomain.example.com

The procedure in point 1 is not possible as of now, because the new search console will not allow you to add a sitemap for any subdomain, inside the http://example.com property.

Also the new search console automatically adds a domain property which consolidates all the properties in your domain including all subdomains. Inside the Domain property you can add any sitemap that corresponds to your website irrespective of whether it is a subdomain or a root domain

html – Como le hago para que cuando le di click en el submit button, se haga el animation y desaparezca el form

Este es mi script de JQuery, se supone que cuando le doy click al boton Submit el form debe de hacer el animation, y despues de acabar con la animation quiero de desapareza todo el form, osea todo el div, pero ahi no se como hacerle.

Este es mi script de JQuery, se supone que cuando le doy click al boton Submit el form debe de hacer el animation, y despues de acabar con la animation quiero de desapareza todo el form, osea todo el div, pero ahi no se como hacerle.

Trate de hacerlo pero div se desaperece desde principio, antes que le de click.

$('#submitButton').onClick(function() {
        $('#comentarios_form').addClass('form1');
});
.form1 {
  position: relative;
  animation: mymove 0.5s;
  transition: visibility;
}

@keyframes mymove {
  from {
    top: 0px;
  }
  to {
    top: 300px;
  }
}

.form2 {
  visibility: hidden;
}

</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" />
<title>Comentarios</title>
</head>

<body>
  <div class="container pt-5 ">
    <h3 class="text-center mb-3 font-weight-bolder">Deja tu comentarios</h3>
    <div id="div1" class="d-flex justify-content-center container-sm p-4">
      <form class="form1" id="comentarios_form">
        <div class="form-row">
          <div class="form-group col-md-6">
            <label for="inputName">Nombre</label>
            <input type="text" class="form-control" name="nombre" id="nombre" required>
          </div>
          <div class="form-group col-md-6">
            <label for="inputLastName1">Apellido</label>
            <input type="text" class="form-control" name="apellido_paterno" id="apellido_paterno" required>
          </div>
        </div>
        <div class="form-row">
          <div class="form-group col-md-6">
            <label for="inputEmail4">Email</label>
            <input type="email" class="form-control" name="email" placeholder="" id="email" required>
          </div>
          <div class="form-group col-md-6">
            <label for="rating">Rating</label>
            <select class="form-control" name="rating_stars" required>
              <option selected disabled value="">Escoge...</option>
              <option>1 estrella</option>
              <option>2 estrellas</option>
              <option>3 estrellas</option>
              <option>4 estrellas</option>
            </select>
          </div>
        </div>
        <div class="form-group">
          <label for="comment">Mensaje</label>
          <textarea class="form-control" rows="5" name="mensaje" id="mensaje" required></textarea>
        </div>
        <div class="text-center  p-3 ">
          <button type="submit" class="btn btn-primary btn-md font-weight-normal" id="submitButton">Submit</button>
          <div class="p-4"></div>
        </div>
      </form>
    </div>
  </div>
 

8 – Missing form state values after adding submit function

I added a submit function in the form_alter hook when inserting a node:

$form('actions')('save_as_draft') = (
  '#type' => 'submit',
  '#value' => t('Save as Draft'),
  '#submit' => ('save_as_draft'),
  '#limit_validation_errors' => (),
);

In the save_as_draft() function, I want to get the address value from the form state, but there are no values (except for the additional submit button).

function save_as_draft(&$form, DrupalCoreFormFormStateInterface $form_state) {
  var_dump($form_state->getValue('field_address'));                      // outputs NULL
  var_dump($form_state->get('field_address'));                           // outputs NULL 
  var_dump($form('field_address')('widget')(0)('value')('#value'));      // outputs 'Address value'
  var_dump(array_keys($form_state->getValues())); // outputs { (0)=>  "save_as_draft" (1)=> "op" }
}

How can I get the form_state values in this alternative submit function without validating the whole form?

Is there another way of retrieving the form values instead of digging through the widget arrays?

Submit URLs created by our client side rendered Angular site through Google Search Console or will Google automatically find them?

Googlebot now executes JavaScript and can automatically crawl and render pages on client side rendered sites. It sounds like you are already doing so, but to let the crawler do its job you need to:

  • Create a separate URL for each piece of content on your site. Google needs to be able to send visitors directly to the content they searched by directing them to a specific URL for that content. You can route all the URLs to the same handler code in Angular and have your code decide which content is appropriate based no the URL.
  • Render <a href=""> links on pages to link to other pages. You can intercept user clicks on those links and update just the content on the page that needs to change and update the URL using pushState. There is no need to make users completely load the whole page again when navigating. However, Google won’t be able to find all the URLs on the site unless you use regular anchor links in your navigation elements.

It still might be a good idea to create an XML sitemap. Google is very slow about crawling and rendering client side generated sites. An XML sitemap could speed up the process of getting Google to discover and crawl your entire site. Without a sitemap it could take months, but with a sitemap it might take as little as a few weeks.

Just because you have an XML sitemap, you still need to link your URLs together with anchor links. Sitemaps help with URL discovery, but they don’t help with URL reputation or rankings. For good SEO, a sitemap is not sufficient. You need to let Googlebot see the relationships between your pages so that it can calculate Pagerank. See The Sitemap Paradox.

reactjs – ¿Cómo puedo redireccionar una ruta con react-router-dom al realizar un evento submit?

Tengo un formulario y quisiera que al hacer submit se redireccione a una ruta en específica. Estoy usando react-router-dom y debe haber alguna forma de redirigir. Quisiera la forma más simple para hacerlo. No quiero que valide al usuario, solo es el front para una aplicación, por ello solo quiero un enrutado fácil y rápido. Muchas gracias por su apoyo.

import React, { useState } from 'react';

const Login = ({ actualizarUsuarioLogeado }) => {

  const (error, guardarError) = useState(false);

  const iniciarSesion = (e) => {
    e.preventDefault();
    actualizarUsuarioLogeado(true);
    guardarError(false);
  }

  return (
    <div>
      <div>
        <form
          onSubmit={iniciarSesion}
        >
          <h3>Login</h3>

          <div className="form-group">
            <label>Email address</label>
            <input type="email" className="form-control" placeholder="Enter email" />
          </div>

          <div className="form-group">
            <label>Password</label>
            <input type="password" className="form-control" placeholder="Enter password" />
          </div>

          <div className="form-group">
            <div className="custom-control custom-checkbox">
              <input type="checkbox" className="custom-control-input" id="customCheck1" />
              <label className="custom-control-label" htmlFor="customCheck1">Remember me</label>
            </div>
          </div>


          <input
            type="submit"
            className="btn btn-primary btn-block"
            placeholder="Submit"
          ></input>


          <p className="forgot-password text-right">
            Forgot <a href="#">password?</a>
          </p>

        </form>
      </div>
    </div>
  )
}

export default Login;

8 – How do I pass a value to a content type field with a custom submit please

and thank you for your patience in helping me learn

I have created a content type called response (Through Drupal, not in a custom module)

In the content type I have a field called field_response_number which is a text field.

When I create new content for the response content type and press submit I want to first submit the form, then run a custom submit afterwards that populates my field_response_number based on the result of a custom function.

I can submit and call my custom form submit function fine, but how do I get the total returned from my custom function to populate the field_response_number please

So my work flow is

  • Create new response content
  • Submit results in form and then call custom submit handler
  • Get count from DB
  • Populate the field_response_number with the result
  • Display result

Can anyone assist please, as I think I’m almost there

My code is as follows

function testmodule_form_node_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  foreach (array_keys($form('actions')) as $action) {
    if ( $form_id == 'node_response_form'){
      if ($action != 'preview' && isset($form('actions')($action)('#type')) && $form('actions')($action)('#type') === 'submit') {
        $form('actions')($action)('#submit')() = 'testmodule_form_submit';
      }
    }
  }
}

function testmodule_form_submit(array $form, FormStateInterface $form_state){
  // This works
  //$result = testmodule_get_node_count('response');
  //drupal_set_message($result);

  How do I populate my field_response_number here please
}

//This handles incrementing by one I want to use to populate the field_response_number with
function testmodule_get_node_count($content_type) {
  $query = "SELECT COUNT(*) FROM {node} n ".
           "WHERE n.type = :type";
  $total = db_query($query, array(':type' => $content_type))->fetchField();
  return $total;
}

Many Thanks for your assistance

Indexer Engine Submit Only Domain [Support]

Indexer Enginee submits only the Domain of the selected URL. It does not submit the full URL, only the domain. Where it the problem?