By Joekz on
Hello,
I have a content Type "Jobs" and i display it with views (block) and i override fields in views-view-fields--jobs--block.tpl.php like this :
<li class="ic-on"><?php print ($fields['field_imagejob']->content);?></li>
<li class="wb-dis"><h4><?php print ($fields['title']->content);?></h4><h5><?php print ($fields['field_time']->content);?></h5></li>
<li class="dr-co"><p><?php print ($fields['field_companyname']->content);?></p></li>
<li class="sa-pn"><p><i class="bung"> </i><?php print ($fields['field_address']->content);?></p></li>
<li class="dolla"><p><?php print ($fields['field_cost']->content);?></p></li>
<li class="b-tn"><div class="apply_btn"><form><input type="submit" name="submit" value="apply"</form></div></li>
Once i clik on apply, i would like to sent mail to : $fields['field_emailjob']->content.
How can i do that! plz i need help
Comments
Sending Email
It looks like all you will need is a hook_form_submit and then the email API:
You can see the hook_form_submit documentation here:
https://api.drupal.org/api/drupal/developer!topics!forms_api_reference.h...
And here is an example of using forms to send email:
https://www.drupal.org/node/1850384
Hope that helps :)
Sending Email
Hello,
The easiest way is to use hook_form_submit to set a specific function to run upon being submitted. I would suggest validating the form data, then proceeding with the email process using drupal_mail. Be sure to validate as email is the most frequently abused system on websites.
Documentation for the hook_form_submit can be found in the form API info here:
https://api.drupal.org/api/drupal/includes!form.inc/function/drupal_form...
Documentation for drupal_mail can be found here:
https://api.drupal.org/api/drupal/includes!mail.inc/function/drupal_mail/7
Hope that helps,
Patrick
Sending email
Hello
You provide few information of your code or your objects but I'll try to post something useful.
1.- Adjustments to the view
In order to obtain plain values without markup, we must to instruct Drupal to render field values
as plain text without HTML tags.
Moreover the filed "Title" is rendered as link to content. That must be corrected too.
2.- In template.php
First: Declare the form
Second(optional): Validate the form
Third: Getting Email components
Fourth: Sending the form
3. In template views-view-fields--jobs--block.tpl
- First: Get the form and the fields to use.
- Second: Override the fields of the view
- Third: Define the form with hidden fields.
This is necessary in order to send the values and process them.
I hope this help you.
Regards.
Raul Garcia
Thank you very much
Thank you very much