Title: add dates to hidden fields values
Last modified: August 30, 2016

---

# add dates to hidden fields values

 *  Resolved [kaysg](https://wordpress.org/support/users/kaysg/)
 * (@kaysg)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/add-dates-to-hidden-fields-values/)
 * I am trying to include the date as the hidden value submitted to salesforce. 
   I found the topic pass-query-param-to-field-value at: [https://wordpress.org/support/topic/pass-query-param-to-field-value](https://wordpress.org/support/topic/pass-query-param-to-field-value)
 * but i am having a difficult time following along/ making it work for me use.
 * Could you point me in the right direction? thanks Graham
 * The filter code i am using from within a custom plugin is:
    ‘add_filter( ‘salesforce_w2l_field_value’,‘
   salesforce_w2l_field_value_querystring_example’, 10, 3 );
 * function salesforce_w2l_field_value_querystring_example( $val, $field, $form ){
 *  $form_id = “3”; // form id to act upon
    $field_name = ’00Nj0000008tKm1′; // 
   API Name of the field your want to autofill $qs_var = date(‘m/d/Y’); // e.g. ?
   source=foo
 *  if( $form == $form_id && $field_name == $field ){
    if( isset( $_GET[ $qs_var])){
   return $_GET[ $qs_var ]; } }
 *  return $val;
 * }’
 * and i am attempting to apply it to the following input field:
    ‘<input type=”
   hidden” id=”sf_00Nj0000008tKm1″ class=”w2linput hidden” name=”00Nj0000008tKm1″
   value=”test1″>’
 * [https://wordpress.org/plugins/salesforce-wordpress-to-lead/](https://wordpress.org/plugins/salesforce-wordpress-to-lead/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Nick Ciske](https://wordpress.org/support/users/nickciske/)
 * (@nickciske)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/add-dates-to-hidden-fields-values/#post-6194340)
 * Close, but your code is still looking at the querystring… try this:
 *     ```
       add_filter( 'salesforce_w2l_field_value', 'salesforce_w2l_field_value_date_example', 10, 3 );
   
       function salesforce_w2l_field_value_date_example( $val, $field, $form ){
   
       $form_id = "3"; // form id to act upon
       $field_name = '00Nj0000008tKm1'; // API Name of the field your want to autofill
   
       if( $form == $form_id && $field_name == $field ){
       return date('m/d/Y');
       }
       }
   
       return $val;
   
       }
       ```
   
 *  Thread Starter [kaysg](https://wordpress.org/support/users/kaysg/)
 * (@kaysg)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/add-dates-to-hidden-fields-values/#post-6194361)
 * Thanks except for one extra closing bracket it works great thanks for the help-
   corrected below
 *     ```
       add_filter( 'salesforce_w2l_field_value', 'salesforce_w2l_field_value_date_example', 10, 3 );
   
       function salesforce_w2l_field_value_date_example( $val, $field, $form ){
   
       $form_id = "3"; // form id to act upon
       $field_name = '00Nj0000008tKm1'; // API Name of the field your want to autofill
   
       if( $form == $form_id && $field_name == $field ){
       return date('m/d/Y');
       }
   
       return $val;
   
       }
       ```
   
 *  [thefreshlab](https://wordpress.org/support/users/thefreshlab/)
 * (@thefreshlab)
 * [10 years ago](https://wordpress.org/support/topic/add-dates-to-hidden-fields-values/#post-6194791)
 * Hi -adding to this thread, how can I include the current page into this – so 
   that we know which page the enquiry came from.
 * we have a number of house properties, with the enquiry form on each page – therefore
   when someone makes an enquiry about the property, we would like to include into
   the enquiry the property (page) name.
 * many thanks

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘add dates to hidden fields values’ is closed to new replies.

 * ![](https://ps.w.org/salesforce-wordpress-to-lead/assets/icon-256x256.png?rev
   =2316786)
 * [Brilliant Web-to-Lead for Salesforce](https://wordpress.org/plugins/salesforce-wordpress-to-lead/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/salesforce-wordpress-to-lead/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/salesforce-wordpress-to-lead/)
 * [Active Topics](https://wordpress.org/support/plugin/salesforce-wordpress-to-lead/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/salesforce-wordpress-to-lead/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/salesforce-wordpress-to-lead/reviews/)

## Tags

 * [dates](https://wordpress.org/support/topic-tag/dates/)
 * [hidden](https://wordpress.org/support/topic-tag/hidden/)
 * [variables](https://wordpress.org/support/topic-tag/variables/)

 * 3 replies
 * 3 participants
 * Last reply from: [thefreshlab](https://wordpress.org/support/users/thefreshlab/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/add-dates-to-hidden-fields-values/#post-6194791)
 * Status: resolved