2014-02-18 6 views
1

클릭시 타사 웹 사이트를 여는 사용자 정의 html 버튼을 추가하는 방법은 무엇입니까? Sugarcrm, 계정 수정보기의 맞춤 버튼 (웹 사이트 링크)?

몇 가지 튜토리얼을 따라하지만, 이러한 코드는 늘 나를 위해 작동 :

 'customCode' => '{literal}<input id="Button" title="Button" class="button" type="button" name="Button" value="Some Button" onClick="window.open("http://google.com","","width=800,height=600");">{/literal}', 
     'sugar_html' => 
      array (
      'type' => 'button', 
      'value' => 'Button', 
      'htmlOptions' => 
       array (
       'class' => 'button', 
       'id' => 'Button', 
       'title' => 'Button', 
       'onclick' => 'window.open("http://google.com","","width=800,height=600");', 
       'name' => 'Button', 
      ), 
     ), 

HTTP 입력 속성으로 처리됩니다 것처럼 '으로'문자열을 '분할합니다 Tryied 문자 모든 종류의 탈출, 모두에게 그들이합니다.! 값 재산 무엇으로 처리하는 내용을 변경하면됩니다. 한 번 나는 그대로 그 URL을 가지고하지 않습니다.

답변

1

당신이 올바른 궤도에있어 꽤 확인합니다. 대신이

'customCode' => '{literal}<input id="Button" title="Button" class="button" type="button" name="Button" value="Some Button" onClick="window.open("http://google.com","","width=800,height=600");">{/literal}',

을 16,

당신은 큰 따옴표에 포함 된 따옴표를했다 ... 혼합 인용되는이

'customCode' => '{literal}<input id="Button" title="Button" class="button" type="button" name="Button" value="Some Button" onClick="window.open(\'http://google.com\',\'\',\'width=800,height=600\');">{/literal}',

의 차이를보십시오. 대신 이스케이프 처리 된 작은 따옴표를 사용하십시오.

+0

그것은 작동해야합니다 :) 나는 그 질문을 쓰고 난 후, 더 간단한 코드로, 그리고 너의 것 같은 것을 발견했습니다. 그래서 나는 너에게 'OK'를 준다. –