function xmlrpc_example_client_form in Examples for Developers 6
Same name and namespace in other branches
- 7 xmlrpc_example/xmlrpc_example.module \xmlrpc_example_client_form()
Present a form that makes use of xmlrpc services to add or subtract.
Related topics
1 string reference to 'xmlrpc_example_client_form'
- xmlrpc_example_menu in xmlrpc_example/
xmlrpc_example.module - Implementation of hook_menu(). Register all the demonstration forms.
File
- xmlrpc_example/
xmlrpc_example.module, line 222 - This is an example of how to implement an XML-RPC server by registering callbacks to specific methods and how to make xmlrpc calls using the builtin xmlrpc() factory provided by Drupal.
Code
function xmlrpc_example_client_form() {
$form = array();
$form['explanation'] = array(
'#markup' => "<div>" . t("The XMLRPC example demonstrates the use of the XMLRPC client in Drupal. <br/>It uses the xmlrpc() function to act as a client, calling itself for some defined methods.<br />An xmlrpc error will result if the result is out of bounds defined by the server.<br />") . "</div>",
);
$form['num1'] = array(
'#type' => 'textfield',
'#title' => t("Enter an integer"),
'#default_value' => 2,
'#size' => 5,
'#required' => TRUE,
);
$form['num2'] = array(
'#type' => 'textfield',
'#title' => t("Enter a second integer"),
'#default_value' => 2,
'#size' => 5,
'#required' => TRUE,
);
$form['add'] = array(
'#type' => 'submit',
'#value' => t("Add the integers"),
'#submit' => array(
'xmlrpc_example_client_add_submit',
),
);
$form['subtract'] = array(
'#type' => 'submit',
'#value' => t("Subtract the integers"),
'#submit' => array(
'xmlrpc_example_client_subtract_submit',
),
);
return $form;
}