Difference between revisions of "Custom Commands Repository"
(New page: == Go To Object == <pre> if (currentLanguage=="java") { window.location=paramJS; } else if (currentLanguage="net") { window.location=paramJS+".aspx"; } else { alert("language: " + ...) |
|||
(11 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
− | + | {{Idiomas | |
− | + | | Repositorio de Custom Commands | |
+ | | Custom Commands Repository | ||
+ | | カスタムコマンドのサンプル集 | ||
+ | }} | ||
== Go To Object == | == Go To Object == | ||
+ | '''Type''': Event <br> | ||
+ | '''Description''': receives the name of a GeneXus object as a parameter in order to browse to its URL. | ||
+ | |||
<pre> | <pre> | ||
Line 8: | Line 14: | ||
window.location=paramJS; | window.location=paramJS; | ||
} | } | ||
− | else if (currentLanguage="net") | + | else if (currentLanguage=="net") |
{ | { | ||
window.location=paramJS+".aspx"; | window.location=paramJS+".aspx"; | ||
Line 14: | Line 20: | ||
else | else | ||
{ | { | ||
− | alert("language: " + currentLanguage); | + | window.alert("language: " + currentLanguage); |
} | } | ||
result = "OK"; | result = "OK"; | ||
return result; | return result; | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | == VerifyUrl == | ||
+ | '''Type''': Validation <br> | ||
+ | '''Description''': receives an URL as a parameter and then validates that the browser's URL matches with it. | ||
+ | |||
+ | <pre> | ||
+ | var url=window.document.location.href; | ||
+ | if(url.indexOf(paramJS)==-1) | ||
+ | result = "OK"; | ||
+ | else | ||
+ | result="falla"; | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | == VerifyTitle == | ||
+ | '''Type''': Validation <br> | ||
+ | '''Description''': receives a title as a parameter, and then checks if the browser's title matches with the parameter. | ||
+ | |||
+ | <pre> | ||
+ | |||
+ | |||
+ | if (document.location.href.indexOf(paramJS)!=-1) | ||
+ | { | ||
+ | result = "OK"; | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | result= "The string ("+paramJS+") is not in the url ("+document.location.href+")"; | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | == ClickGridButtons == | ||
+ | '''Type''': Action <br> | ||
+ | '''Descripción''': Clicks on grid's buttons - "First", "Previous", "Next" o "Last". | ||
+ | |||
+ | <pre> | ||
+ | |||
+ | function CustomCommand (paramJS, currentGXVersion, currentLanguage) | ||
+ | { | ||
+ | |||
+ | window.document.getElementsByClassName("PagingButtons" + paramJS)[0].click(); | ||
+ | |||
+ | result = "OK"; | ||
+ | return result; | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | == ClickChangeImage == | ||
+ | '''Type''': Action <br> | ||
+ | '''Description''': Performs a click over the Change button of a multimedia field (for example an image), only in GeneXus Ev2. Recieves the name of the attribute or variable corresponding to the multimedia field.<br> | ||
+ | '''Example''': ClickChangeImage("ATTRACTIONPHOTO").<br> | ||
+ | |||
+ | [[Image:GXEv2ImageChangeDelete.png]] | ||
+ | |||
+ | <pre> | ||
+ | |||
+ | function CustomCommand (paramJS, currentGXVersion, currentLanguage) | ||
+ | { | ||
+ | |||
+ | window.document.getElementById(paramJS + '_ct').childNodes[0].focus(); | ||
+ | window.document.getElementById(paramJS + '_ct').childNodes[0].click(); | ||
+ | |||
+ | result = "OK"; | ||
+ | return result; | ||
+ | } | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | |||
+ | == ClickDeleteImage == | ||
+ | '''Type''': Action <br> | ||
+ | '''Description''': Performs a click over the Delete button of a multimedia field (for example an image), only in GeneXus Ev2. Recieves the name of the attribute or variable corresponding to the multimedia field.<br> | ||
+ | '''Ejemplo''': ClickDeleteImage("ATTRACTIONPHOTO").<br> | ||
+ | |||
+ | [[Image:GXEv2ImageChangeDelete.png]] | ||
+ | |||
+ | <pre> | ||
+ | |||
+ | function CustomCommand (paramJS, currentGXVersion, currentLanguage) | ||
+ | { | ||
+ | |||
+ | window.document.getElementById(paramJS + '_ct').childNodes[1].focus(); | ||
+ | window.document.getElementById(paramJS + '_ct').childNodes[1].click(); | ||
+ | |||
+ | result = "OK"; | ||
+ | return result; | ||
+ | } | ||
</pre> | </pre> |
Latest revision as of 01:54, 21 February 2014
Contents |
Go To Object
Type: Event
Description: receives the name of a GeneXus object as a parameter in order to browse to its URL.
if (currentLanguage=="java") { window.location=paramJS; } else if (currentLanguage=="net") { window.location=paramJS+".aspx"; } else { window.alert("language: " + currentLanguage); } result = "OK"; return result;
VerifyUrl
Type: Validation
Description: receives an URL as a parameter and then validates that the browser's URL matches with it.
var url=window.document.location.href; if(url.indexOf(paramJS)==-1) result = "OK"; else result="falla";
VerifyTitle
Type: Validation
Description: receives a title as a parameter, and then checks if the browser's title matches with the parameter.
if (document.location.href.indexOf(paramJS)!=-1) { result = "OK"; } else { result= "The string ("+paramJS+") is not in the url ("+document.location.href+")"; }
ClickGridButtons
Type: Action
Descripción: Clicks on grid's buttons - "First", "Previous", "Next" o "Last".
function CustomCommand (paramJS, currentGXVersion, currentLanguage) { window.document.getElementsByClassName("PagingButtons" + paramJS)[0].click(); result = "OK"; return result; }
ClickChangeImage
Type: Action
Description: Performs a click over the Change button of a multimedia field (for example an image), only in GeneXus Ev2. Recieves the name of the attribute or variable corresponding to the multimedia field.
Example: ClickChangeImage("ATTRACTIONPHOTO").
function CustomCommand (paramJS, currentGXVersion, currentLanguage) { window.document.getElementById(paramJS + '_ct').childNodes[0].focus(); window.document.getElementById(paramJS + '_ct').childNodes[0].click(); result = "OK"; return result; }
ClickDeleteImage
Type: Action
Description: Performs a click over the Delete button of a multimedia field (for example an image), only in GeneXus Ev2. Recieves the name of the attribute or variable corresponding to the multimedia field.
Ejemplo: ClickDeleteImage("ATTRACTIONPHOTO").
function CustomCommand (paramJS, currentGXVersion, currentLanguage) { window.document.getElementById(paramJS + '_ct').childNodes[1].focus(); window.document.getElementById(paramJS + '_ct').childNodes[1].click(); result = "OK"; return result; }