What is the analytical form of the cylindrical wave appearing on reflection of a plane wave from a corner?

This is a cross-post from Math.SE, where no answer was given after 3 months.


Consider a plane 2D wavelet moving towards a corner reflector with 120° opening angle with infinitely extended sides. The surface of the reflector has homogeneous Dirichlet boundary conditions imposed, and the wave obeys the usual hyperbolic wave equation:

$$partial_{tt} u(x,y,t)=partial_{xx}u(x,y,t)+partial_{yy}u(x,y,t).$$

The solution, with the initially propagating part and the reflections, can be easily constructed by rotating the initial wavelet, changing its sign and putting the resulting wavelet next to the initial one so as to satisfy the boundary conditions by canceling the wave function at the boundaries. The result will look like this (ignore the small-wavelength artifacts, they are due to numeric errors in the simulation):

incident wave with the reflections

But as the points of the slanted reflected waves come close to the corner, there appears a problem: simply “sliding” the reflected part no longer works, since the shape of the reflecting boundary abruptly changes. Moreover, numerical simulation (see below) shows that the reflection from the corner doesn’t produce a backwards-propagating plane wave (that we’d get from a 90° corner): instead the original slanted reflections continue their paths, and a new, cylindrical, wave originates from the corner. This cylindrical wave appears to cancel out the values of the slanted reflections on the boundary to satisfy the boundary conditions.

reflected wave

My question is: what is the analytical form of this cylindrical wave? It doesn’t seem to be a Bessel function, because Bessel functions don’t have constant amplitude nor constant wavelength (they change with radius). So what is it then? Does it have a closed form? Or is it at least explicitly expressible as an integral or a series?

Comment Form Development Issue – WordPress Development Stack Exchange

I am new to wordpress theme development and I am trying to create a custom comment form. I read the documentation and I have a reach a point that I am happy with the layout but I have 2 issues with form’s functionality.

First issue is when I am logged in to wordpress when I hit the “Post Comment” button, the message is not saved in MySQL. I believe that I am not doing something correctly while retrieving user input.

My second issue is that when I am logged out, I have some fields name and email which are not saved also for a reason and I face the below error: Error: Please fill the required fields (name, email).

Attached you will find the code that I used to create the custom comment form. The function is called from single.php file which is the file that I created to display a single post.

Please note that I am asking your help not to resolve it for me, but just to learn and identify what I am doing wrong. Excuse my bad english. I am Greek!

function dck_custom_comment_form() {
//Declare Vars
$comment_author = 'Name *';
$comment_email = 'Email *';
$comment_body = 'Comment *';
$comment_cookies_1 = ' By commenting you accept the';
$comment_cookies_2 = ' Privacy Policy';
$commenter = wp_get_current_commenter();

$fields = array(
    //Author field
    'author' => '<div class="row"><div class="col-md-6"><div class="form-group"><input name="Name" id="name" placeholder="' . $comment_author .'" class="form-control" type="text" value="' . esc_attr( $commenter('comment_author') ) . '"></div></div>',
    //Email Field
    'email' => '<div class="col-md-6"><div class="form-group"><input name="Email" id="email" placeholder="' . $comment_email .'" class="form-control" type="email" value="' . esc_attr(  $commenter('comment_author_email') ) . '"></div></div></div>',
    //Cookies
    'cookies' => '<div class="col-md-12"><div class="form-group"><input type="checkbox" required>' . $comment_cookies_1 . '<a href="' . get_privacy_policy_url() . '">' . $comment_cookies_2 . '</a></div></div>',
);

//Array
$comments_args = array(
    'fields' => $fields,
    'comment_field' => '<div class="row"><div class="col-md-12"><div class="form-group"><textarea name="message" id="message" placeholder="' . $comment_body .'" rows="4" aria-required="true" class="form-control"></textarea></div></div></div>',
    'comment_notes_after' => '',
    'title_reply' => 'Please Post Your Comments & Reviews',
    'label_submit' => 'Post Comment'
);
comment_form( $comments_args );}


function dck_reorder_comment_form_fields( $fields ) {
$comment_field = $fields('comment');
$cookies = $fields('cookies');
unset( $fields('comment') );
unset( $fields('cookies') );
$fields('comment') = $comment_field;
$fields('cookies') = $cookies;
return $fields;
}

react.js – React – form of multiple components

I need to create a form in React made of multiple components, such as <TextField>, <DropDown>, <DatePicker> where each one has a different props, some of them are common such as Id, Label

Question is how should I program this, I have come with a few ideas ->

  1. It would be easier to split it into separate arrays: dropdowns, textFields, datePickers and then render them via .map(), but it wouldn’t work as they are not in order in the form

  2. Put all of components into array and render them via .map() with if/switch/function where I would decide which component is which

 const App = (props) => {
  const forms = props.forms
  const getItem(type) {
    if (type === Type.DropDown) {
      return <Dropdown dropDownProps>
    }
    ....
  }
  return (
    forms.map(item => {
      return getItem(item.type)
    })
  )
}

Next question is how/where to store all props – there is about 10 of these fields in the form, so should I do some file like InitData.ts with

const FirstField = {id: 0, label: "FirstField"}
...

but then how would I pass props such as onChange etc?

8 – How do I render a form in a div through a javascript call

I’m trying to load a form into a div using a javascript call. I can get the form in the div, but nothing works (autocomplete fields, wysiwyg fields, custom submit handler).

I know I must be missing something, but I can’t figure out what it is.

What I have now to get the form:

$form = Drupal::formBuilder()->getForm('Drupalmy_moduleFormMyForm');
$renderable = (
   '#theme' => 'my_form',
   '#form' => $form,
);
$rendered = Drupal::service('renderer')->renderPlain($renderable);

$response = new AjaxResponse();
$response->setData($rendered);
return $response;

I’ve also tried renderRoot instead of renderPlain, but to no avail.

The twig file looks like this (very simple):

<div id="form-container">
    {% include 'header.html.twig' with {
        type : 'manual'
    } %}
    <div class="content">
        {{ form }}
    </div>
</div>

Any help will be greatly appreciated.

office 365 – Web form on WordPress (CF7 plugin) to Microsoft List (O365 / sharepoint)

General how-to question I haven’t been able to find an example of – please let me know if this is the right forum for this.

I have a WordPress website with plugin Contact Form 7 for users to submit questions. Natively, the contact form 7 only emails submissions, but there is an additional plug-in I can use to record those submissions to a table in the MySQL database used by WordPress.

What I’d like to do is record a new item in O365 / Microsoft List when someone submits a form. I kind of assume this will involve using Flow / PowerAutomate to pick up the form submission and create a list item out of it, but I’m not sure how I can trigger the flow, or retrieve the submitted data.

One option that crossed my mind was to just use an email trigger, so that when an email arrives, the contents of the email are used, but the additional step of sending email, then parsing email contents seemed like would be unnecessary complication, and more opportunity for failure. Is there a way to trigger flow and retrieve data directly from the WordPress database table?

I’m open to other Form options, but would prefer to use the one I’m already using, as there are other factors to form selection, as well as the fact that I have many websites to do this on, and would need to make a lot of changes if I switch away from CF7.

Thanks for any ideas and input.

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?

8 – How can I prevent URLs in form fields?

Was looking around the interface to figure this out. Is there any way to prevent URLs in the form fields and prevent submission of the forms? Was looking to check for “http” and “http”s in the string.

There’s seems like a way to check for a pattern in the string… but it’s the reverse, the string needs to be there.

I am on Drupal 8.9.1.

Webform is Version: 8.x-5.16

8 – How do I verify emails on a contact form?

I want to implement a functionality where anonymous users can contact node authors. I have created a contact form with email field for each node. I would like to send an email verification link to the email address for email ownership confirmation. The form submit should be complete only when that happens.

What would be the best approach to handle this? There is a module in drupal 7 which could work but I didn’t come across anything for D8. Will appreciate any help with this.