Hi everyone,
I'd like to use Views Embed Form to create a form with a text field and a submit, when submitted information are sent to the system email configured in Site Information, the information sent should contain the node id, the text field content, thats it.
Any clue where to begin ?
Thanks,

Comments

meba’s picture

Hi,

you need to create your own module first. It's easy and you will find plenty of tutorials on google.

You need to create your own form then, something like:

function YOURMODULE_send_form(&$form_state, $row) {
// $row is the node - you need $row->nid
}

After that, you have to implement simple VEF api:

function YOURMODULE_views_embed_form() {
// Note no access check - anonymous should have access?
 return array('YOURMODULE_send_form' => t('Textfield send form'));
}

You will see your form in Views field settings after that and you can use it.

Is this enough?

Heilong’s picture

Hi,
I just try to modify the default form provided with the VEF module for testing purpose. To have a field added to the form, I used this :

function vef_test_form(&$form_state, $row) {
  $form = array();
  $form['text'] = array(
      '#type' => 'text',
      '#name' => 'question' . intval($row->nid),
      '#value' => '',
      );
  $form['submit'] = array(
      '#type' => 'submit',
      '#name' => 'submit' . intval($row->nid),
      '#value' => 'Click me!',
      );
  $form['nid'] = array(
      '#type' => 'hidden',
      '#value' => intval($row->nid),
      );
  return $form;
}

After when I refreshed the view page no text field is displayed.

meba’s picture

Status: Active » Closed (won't fix)

Do you still have the problem? It's more like a support issue for developing modules, not VEF module.