[support] Submit a form from a link...

Lior Kesos lior.kesos at gmail.com
Tue Jan 30 08:35:20 UTC 2007


Hi,
I'm doing some privatemsg module hacking and my client want's to break the
"bunch of buttons" paradigm and to have a nicely styled message center.
I need to wrap some of the buttons with classy divs but that's not the
problem here..

I need to find a way to substitute a forms submit button with a link.
This is what I have so far...

 $form['new_folder'] = array(
      '#value' => '<a href="javascript:forms.privatemsg_list_form.submit()">New
folder</a>',
      '#name' => 'op'
      );

instead of something like this ..

  $form['new_message'] = array(
      '#type' => 'submit',
      '#value' => t('Write a new message'),
      '#name' => 'op'
      );

Now the form that receives this uses the value submitted to enter a case
clause so I need to pass the text as the submitted value...

switch ($op) {
    case 'list':
      $output = _privatemsg_list($arg);
      $title = t('Private messages');
      break;
    case 'view':
      $output = _privatemsg_view($arg);
      $title = t("Read message");
      $breadcrumb = array(l(t('Home'), ''), l(t('private messages'),
'privatemsg'));
      break;
    case t('Write a new message'):
      $arg = "";
    case 'form':

etc...

Any ideas or reference implementations?
Lior

---
ליאור קסוס , לינוויט
http://www.linnovate.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20070130/ccdcb138/attachment.htm 


More information about the support mailing list