Hi Team,
Can some one suggest us the way to add custom button next to SAVE, CANCEL Any module and custom Module.
Also please suggest how can we write some custom on the click of the button.
Regards,
Deepak
Hi Team,
Can some one suggest us the way to add custom button next to SAVE, CANCEL Any module and custom Module.
Also please suggest how can we write some custom on the click of the button.
Regards,
Deepak
Hi Ramana,
Thanks for your reply.
It is little confusing for me.
I am attaching the screen shot where i want to add custom button for your better understanding.
Can you suggest more examples.
Regards,
Deepak
Hi Parag Mittal
Okay, you are using sugar 6.x.
custom/modules/Accounts/metadata/editviewdefs.php and add this code:
'templateMeta' =>
// Add this code
array (
'javascript' => '
<script src="./include/javascript/jquery.min.js" type="text/javascript"></script>
<script src="./custom/include/javascript/test.js" type="text/javascript"></script>
',
),
array (
'buttons' =>
array (
0 => 'SAVE',
1 => 'CANCEL',
// Add This code
2 =>
array (
'customCode' => '<input id="MyButton" title="My Button" class="button" type="button" name="MyButton" value="My Button" onclick="myButtonFunt();">',
),
),
Now in your custom/include/javascript/test.js file write all your script code to do so:
$(document).ready(function(){
function myButtonFunt(){
console.log("Hi Friends am Triggered..");
}
});
Once check with this approach and let me know if you found any issues.
Hope this Helps
Best Regards
S Ramana Raju
Hi Parag Mittal
Okay, you are using sugar 6.x.
custom/modules/Accounts/metadata/editviewdefs.php and add this code:
'templateMeta' =>
// Add this code
array (
'javascript' => '
<script src="./include/javascript/jquery.min.js" type="text/javascript"></script>
<script src="./custom/include/javascript/test.js" type="text/javascript"></script>
',
),
array (
'buttons' =>
array (
0 => 'SAVE',
1 => 'CANCEL',
// Add This code
2 =>
array (
'customCode' => '<input id="MyButton" title="My Button" class="button" type="button" name="MyButton" value="My Button" onclick="myButtonFunt();">',
),
),
Now in your custom/include/javascript/test.js file write all your script code to do so:
$(document).ready(function(){
function myButtonFunt(){
console.log("Hi Friends am Triggered..");
}
});
Once check with this approach and let me know if you found any issues.
Hope this Helps
Best Regards
S Ramana Raju
Hi Ramana,
Thanks for the Reply.
Just a though, all above code should not be the part of Extension folder as it is custom code?
It may cause issues with other customization.
Or frame work will take care of it.
Regards,
Deepak
Hi Ramana,
The code which u shared is working fine. I am trying to add one more Button but it is not working.
can please suggest how can i add one more custom Button.
Following is working code:
array (
'buttons' =>
array (
0 => 'SAVE',
1 => 'CANCEL',
// Add Custom Code
2 =>
array (
'customCode' => '<input id="BillToValidateButton" title="Bill To Button" class="button" type="button" name="BillToButton" value="Bill To Validate" onclick="myButtonFunt();">',
),
),
I want to add one more Button next to my Custom Button following is the code i am trying but it is not working.
array (
'buttons' =>
array (
0 => 'SAVE',
1 => 'CANCEL',
// Add Custom Code
2 =>
array (
'customCode1' => '<input id="BillToValidateButton" title="Bill To Button" class="button" type="button" name="BillToButton" value="Bill To Validate" onclick="myButtonFunt();">',
'customCode2' => '<input id="ShipToValidateButton" title="Ship To Button" class="button" type="button" name="ShipToButton" value="Ship To Validate" onclick="myButtonFunt();">',
),
),
I am not able to find the root cause why it is not working can you please help me.
Regards,
Deepak
Following code is working:
array (
0 => 'SAVE',
1 => 'CANCEL',
// Add Custom Code
2 =>
array (
'customCode' => '<input id="BillToValidateButton" title="Bill To Button" class="button" type="button" name="BillToButton" value="Bill To Validate" onclick="billToButtonFunt();">
<input id="ShipToValidateButton" title="Ship To Button" class="button" type="button" name="ShipToButton" value="Ship To Validate" onclick="shipToButtonFunt();">',
),
Thanks
Try this:
array(
'buttons' =>
array(
0 => 'SAVE',
1 => 'CANCEL',
// Add Custom Code
2 =>
array(
'customCode1' => '<input id="BillToValidateButton" title="Bill To Button" class="button" type="button" name="BillToButton" value="Bill To Validate" onclick="myButtonFunt();">',
),
3 => array(
'customCode2' => '<input id="ShipToValidateButton" title="Ship To Button" class="button" type="button" name="ShipToButton" value="Ship To Validate" onclick="myButtonFunt();">',
)
),
)
Hi Parag Mittal
You code syntax is wrong.
Do as Alan Apter suggested. It will work
Let me know further help.
Best Regards
S Ramana Raju
Hi Parag
Glad that it Helped you
Best Regards
S Ramana Raju
Hi Parag Mittal
If the post really helped you, mark it as Answer Correct, Helpful and Like.
By doing this we are giving appreciation for their work/help
Regards
Syad
Hello,
I have tried this, I can't get it to work. I am using SugarCRM version 6.5. I am putting a button on detail view, not edit view, so this is what I put in my detailviewdefs.php:
$viewdefs['Cases']['DetailView'] = array(
'templateMeta' => array('form' => array(
array (
'javascript' => '
<script src="/custom/include/javascript/jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="/custom/modules/Cases/scripts/detailview/additionalInfoPopup.js" type="text/javascript"></script>
',
),'buttons' => array(...
The paths you can see there are absolute, starting at my sugarcrm root folder. I have verified that the files are there by navigating to them directly in the browser. I put absolute paths there after some experimentation. Unfortunately nothing has worked.
The button I have added has the event handler like you specified,
onclick="myButtonFunt();"
but when I click the button I get
RefereneError: myButtonFunt is not defined
The contents of additionalInfoPopup.js are exactly the same as your example.
What am I doing wrong?
EDIT: Some additional info:
I have viewed the page source and there isn't a mention of my included script files. Also when I view the debugger tab in Firefox, the script file additionalInfoPopup.js doesn't seem to be loaded.
I have tried putting the 'javascript' => array both inside and outside the 'form' => array. Neither of these approaches worked.