Hi! I use this module for admins to prepopulate a custom content type using an bookmarklet. I think the bookmarklet is okay, but the fields aren't prepopulated from the url.

The content type has three text fields:

<input id="edit-title-0-value" class="text-full form-text required" type="text" aria-required="true" required="required" placeholder="" maxlength="255" size="60" value="" name="title[0][value]">

<textarea id="edit-field-quick-descrptn-0-value" class="text-full form-textarea resize-vertical" placeholder="" cols="60" rows="5" name="field_quick_descrptn[0][value]"></textarea>

<input id="edit-field-quick-url-0-uri" class="form-autocomplete form-text ui-autocomplete-input" type="text" placeholder="" maxlength="2048" size="60" value="" name="field_quick_url[0][uri]" data-autocomplete-path="/entity_reference_autocomplete/node/default" aria-describedby="edit-field-quick-url-0-uri--description" data-autocomplete-first-character-blacklist="/#?" autocomplete="off">

This is my bookmarklet:

javascript:u=document.location.href;t=document.title;s=window.getSelection();void(window.open(%22http://www.whatever.com/node/add/quicklink?edit[title][0][value]=%22+escape(t)+'&edit[field_quick_descrptn][0][value]='+escape(s)+'&edit[field_quick_url][0][uri]='+escape(u),'_blank','width=540,height=500,status=yes,resizable=yes,scrollbars=yes'));

The url I get is:

http://www.whatever.com/node/add/quicklink?edit[title][0][value]=Applying%20SMACSS%20to%20Drupal%20|%20Aten%20Design%20Group&edit[field_quick_descrptn][0][value]=You%20need%20SMACSS.&edit[field_quick_url][0][uri]=http%3A//atendesigngroup.com/blog/applying-smacss-drupal

And the error I get is:

Notice: Undefined index: #type in Drupal\prepopulate\Controller\prepopulateController->_prepopulate_request_walk() (line 32 of modules/prepopulate/src/Controller/prepopulateController.php).

Drupal\prepopulate\Controller\prepopulateController->_prepopulate_request_walk(Array, Array)
prepopulate_after_build(Array, Object)
call_user_func_array('prepopulate_after_build', Array)
Drupal\Core\Form\FormBuilder->doBuildForm('node_quicklink_form', Array, Object)
Drupal\Core\Form\FormBuilder->processForm('node_quicklink_form', Array, Object)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object)
Drupal\node\Controller\NodeController->add(Object)
call_user_func_array(Array, Array)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\PageCache->pass(Object, 1, 1)
Drupal\Core\StackMiddleware\PageCache->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1)
Stack\StackedHttpKernel->handle(Object, 1, 1)
Drupal\Core\DrupalKernel->handle(Object)

Any idea what I'm doing wrong?

I appreciate any help. Thank you for porting this great little module to 8!

Kathy

Comments

juliencarnot’s picture

Status: Active » Closed (duplicate)
Parent issue: » #2467285: Error: Notice: Undefined index: #type

This looks a lot like a duplicate and is very likely to be fixed with the alpha release.