Sunday, August 29, 2010

add custom field to com_google

Suppose that u need to add extra field call "Phone number" on your contact us page. Follow the steps bellow.

1.Open
components ->com_google->views->google->tmpl->default.php - on the front end

see the line no 302 and add






code to default.php file

2. Java Script validation
see function comGoogleFrmValidate(comfrm) on default.php file

and add to following code



user_tp_val= document.comGoogleForm.user_tp;
if(my_name.value == '')
{
errorStr += "Add Tp no\n";
user_tp_val.style.borderColor = "#FF0000";

}




3. Open controller.php file
components->com_google->controller.php

4.see the line 29
and modify the 'function sendMail() '

$user_tp= JRequest::getVar( 'user_tp', 0, '', 'text' );

And aslo update

$body = "From ".$friendEmail."\n".$messText."\n".$user_tp."\n";


if not clear ple comment

3 comments:

  1. Thanks!!! It works , you are really helpful.

    For the Java Script Validation:
    I'm using "user_tp" instead of "my_name"

    Thanks again

    ReplyDelete
  2. ohh yes it's mistake ...
    now it's corrected

    ReplyDelete
  3. I cannot find a way to get in touch with you. I added the google component and cannot figure out how to edit the info that is in the pop up bubble when you click on the pointer in the map

    ReplyDelete