forms – What is best practice for passing routing parameters?

In submitForm() I want to redirect to a controller and pass the form values. The form values are all arrays, btw.

Here is submitForm.

public function submitForm(array &$form, FormStateInterface $form_state) {
    // get values
    $demo_values = $form_state->getValue('demo');
    $data_set_value = $form_state->getValue('data_set');
    $engineering_degrees1 = $form_state->getValue('engineering_degrees1');
    $engineering_degrees2 = $form_state->getValue('engineering_degrees2');
    $engineering_degrees3 = $form_state->getValue('engineering_degrees3');
    $engineering_degrees4 = $form_state->getValue('engineering_degrees4');
    $physical_science_degrees = $form_state->getValue('physical_science_degrees');

    # set form data in url redirect
    $params = ('demos' => $demo_values,
      'data_set' => $data_set_value,
      'engineering_degrees1' => $engineering_degrees1,
      'engineering_degrees2' => $engineering_degrees2,
      'engineering_degrees3' => $engineering_degrees3,
      'engineering_degrees4' => $engineering_degrees4,
      'physical_science_degrees' => $physical_science_degrees);

Here is my routing YML file.

  path: '/statistics/stats-degrees'
    _title: 'Engineering and Physical Science Degrees Earned by Members of Underrepresented Groups'
    _form: 'Drupalstats_degreesFormStatsDegreesForm'
      _permission: 'access content'
  path: '/statistics/stats-degrees-chart/{demos}/{data_set}/{engineering_degrees1}/{engineering_degrees2}/{engineering_degrees3}/{engineering_degrees4}/{physical_science_degrees}'
    _controller: 'Drupalstats_degreesControllerStatsDegreesController::stats_degrees_chart'
    _permission: 'access content'

Here is my Controller method call.

public function stats_degrees_chart($demos,$data_set,$engineering_degrees1,$engineering_degrees2,$engineering_degrees3,$engineering_degrees4,$physical_science_degrees) {

Currently, it’s throwing a 500 error after I submit the form. Is there a better way to pass the parameters to the controller?

forms – Profile webform core exception error on wordpress

forms – Profile webform core exception error on wordpress – WordPress Development Stack Exchange

forms – What’s a better way to enable a feature – checkbox or dropdown?


As others have stated, it can depend on a variety of factors, such as what this control is used for. However, my immediate response is very emphatically that option A is clearly superior. Option B is just too clunky.


With option A, I can set the location of all my widgets until I like the interface. Then, I can simply enable and disable any particular widget I want to see at that moment and it’s right where I left it.

With option B, if I want to re-enable a widget, not only do I have to click a button to enable it, I have to read a list of locations, remember where I wanted it, and click that location. It’s not the end of the world, but is far less streamlined.

With regards to placing the widget to begin with: With A, I have to click once to enable, then click twice more to pick a location. With B, I only have to click twice to pick a location. So the initial selection is ever-so-slightly simpler with option B, but I just can’t see that being worth all time wasted in the future.

Other Factors

As soon as your widget placement gets more complex than 4 preset locations, option A becomes almost mandatory. The only way I could see option B still working with, e.g., 16 locations is if you had tickboxes arranged so they represent the physical spot in the screen with a final option for “disabled”. But even there, option A would be better for the reasons above.

Animation of widget options being selected in each style.

Option B might become more appealing if you can only have one widget per corner, and there are a lot of widgets to pick from. Because now you might change the location every time you change widgets. However, in this case it would almost certainly be better to simply have a dropdown for each corner, instead of a selection for each widget.

forms – What’s a better way to enable the feature – checkbox or dropdown?

Imagine a form where you can enable a feature. After enabling, you have some additional options related to the feature.

(A) Would you design a checkbox for enabling/disabling the feature + a dropdown list to select additional options


(B) Would you design a single dropdown with options: Disabled, Enabled with option 1, Enabled with option 2….


enter image description here


enter image description here

forms – How could I best indicate the required format for a phone number (country + area code)

I can’t remember any one time that someone has gotten this right. They just expect you to know the format to input. This really sucks when someone’s new to a country and not really well versed on how phone numbers in a country look like.

Now, I sort of agree with @MSalters‘ answer, you should use JavaScript to clean up the input. But, I find that forms that aren’t clear about the correct phone number format are mentally jarring. This makes finishing the form even more of a chore than it already is.

So please, don’t disregard the design portion of this input field. The easier your form is to understand the quicker users will finish it. Which, I’m guessing, is what you want, no?

Oh and Alternative 1 is the best option for me. You could also make it so that the suggestion is inside the field (using placeholder attribute)

forms – How to prevent theme change caused by $rendererService->renderPlain()

I’m trying to re-use the output from a heavily customized field formatter as <select><option> text in a Webform. I managed to re-use field display, but it has the side-effect of switching the theme used for rendering.

Below is a simplified code, the lines $dateRenderArray = ... and $dateHtml = ... are original and cause the problem:

function mymodule_webform_options_alter(array &$options, array &$element, $options_id = NULL) {
  foreach ($options as $value => $text) {
    $entity = getEntityByOption($value);

    //reuse custom field formatter output
    $dateRenderArray = $entity->get('field_daterange')->view('teaser');

    //the following line causes the theme change
    $dateHtml = Drupal::service('renderer')->renderPlain($dateRenderArray);

    $datePlaintext = str_replace(("n", "&nbsp;"), ("", " "), trim(strip_tags($dateHtml)));
    $muchBetterOptionText = $someOtherPlaintextFromEntity . '  ' . $datePlaintext;
    $options($value) = $muchBetterOptionText;

This works excellent in the frontend form, for the submission emails and also in the admin webform submission list.

But in a single webform submission detail view, those lines cause an unwanted theme change from admin theme to frontend theme.

How can I prevent the theme change from renderPlain() and keep the admin theme when viewing a single webform submission?

Optional bonus question:
Why does my hook work correctly in the webform submission list and not in webform submission detail view? The submission list uses exactly the same function, it renders the same processed option text in the corresponding column, but I do correctly stay inside the admin theme when viewing the list. But only in the detail view switches to the frontend theme.

forms – Help on separating terms in autosuggestion

I was working on a solution where we introduce an autosuggestion component to our users so we can enable them to fill the required information in a better way. This list use more than 1000 words in our DB so while the user is typing we can suggest terms to fill. Easy:

suggestion 1

Sometimes, the user has to introduce two terms, so my idea was to simply enable this by separating with a “,”. Easy:

suggestion 2

The problem:
I’ve realized by looking at the DB that some terms actually has a “,” in their names, for example:

Word 7, something

So this pretty much destroy my idea of using “,” to separate different terms, because if the user is typing the correct name that has a coma in it, the suggestion fill will simply start providing suggestions to a new term.
I cannot force the user to use this list because its items are going to be growing in time, this is not a stone source of truth.
I though in using Chips from Material Design but some users simply copy and paste a whole list of terms (and keep in mind that I cannot automatically convert this to chips because some names actually have a , in it). I thought in provide a “Tab” key to separate terms but this will imply an accessibility issue. I also though in use one input for each product but this will mean a potential constraint for users.
I’m really stuck in here and I’ve reading a lot of documentation about autosuggestions to see if I can get another option but can find any.

I feel that I hit a wall here.

Does anybody has an alternative idea in mind to provide an easy way to contemplate “,” in an autosuggestion component while we need the user to add more terms in it?

forms – How can I select multiple rows from a table and let the submission handler know which rows have been selected?

In a custom module, I have a form showing a table with multiple rows, as in the screenshot.


Once users select one or more rows, and they click on the Delete button, rows in the database should be deleted.

I’ve built a tableselect table with type. I cannot understand how to get the selected table rows in the submission handler.

How can I achieve this?

The following is the code I am using to build the form.

foreach ($result as $row) {
  $data() = (
      'data' => (
        '#theme'      => 'image',
        '#alt'        => 'catImg',
        '#uri'        => File::load($row->Image)->getFileUri(),
        '#width'      => 100,
    t("<a href='editKitty/$row->id' class='db-table-button 
    db-table-button-edit use-ajax' data-dialog-type='modal'>Edit</a>"),
    t("<a href='delete-cat/$row->id' class='db-table-button
    db-table-button-edit use-ajax' data-dialog-type='modal'>Delete</a>"),

$header = (
  t('image'), t('Name'), t('Email'), t('Created'),
  t('Edit'), t('Delete'),

$build('table') = (
  '#type' => 'tableselect',
  '#header' => $header,
  '#options' => $data,

$build('submit') = (
  '#type' => 'submit',
  '#name' => 'submit',
  '#value' => $this->t('Delete'),

nt.number theory – Is there an analogue for Ramanujan–Serre derivative for Hilbert modular forms?

If $f$ is a modular form of weight $k$, it is well known that
D(f)=f’ -tfrac k{12}E_2f

is modular of weight $k+2$.
Here $E_2$ is the Eisenstein series. I wanted to ask if there is an extension of this fact for Hilbert modular forms.

When looking up Hilbert modular forms (Shimura 1975), I was only able to find the following differential operators: for a Hilbert modular form $f$ on $mathbb H^n$, we define
D_{j,t}(f)=left(frac{t}{2i y_j}+frac{partial}{partial z_j}right)f

where $z_j=x_j+iy_j$ is the $j$-th coordinate. I don’t think this is the same operator (is it?)

I am really looking for a many variable version of the operator $D(f)=f’ -frac k{12}E_2f$. I don’t really have a background in analysis or number theory so this question may be really easy for experts.

Is every differential 1-form a linear combination of closed forms?

Let $M$ be a smooth manifold. We know that the $C^infty (M)$-module $Omega^1 (M)$ is finitely generated, i.e. there exists $1$-forms ${alpha_1, ldots, alpha_k }$ such that for any $1$-form $omega$, we can write $omega = sum_{i=1}^k f_i alpha_i$ for some $f_i in C^infty (M)$.

I’m wondering if the $alpha_i$ can be chosen to be closed, or, furthermore, exact.

I’m guessing there must exist a counterexample, as I haven’t seen this result in any of the standard textbooks or online sets of notes, and it might make computations a little too easy. I’ve been toying around with this idea for a while but haven’t gotten any leads in either direction, except that this is trivially true in $mathbb{R}^n$.

Have any of you seen this result or know a counterexample?

DreamProxies - Cheapest USA Elite Private Proxies 100 Cheap USA Private Proxies Buy 200 Cheap USA Private Proxies 400 Best Private Proxies Cheap 1000 USA Private Proxies 2000 USA Private Proxies 5000 Cheap USA Private Proxies - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies New Proxy Lists Every Day Best Quality USA Private Proxies