Submit form to self ~ Where is that option?

cubefree 25 Oct, 2012
I am using a ChronosForm to submit a SMS msg to a cell phone.
I am using Twilio, https://www.twilio.com/ as the sms provider.

We are trying to mimic this method, see here --> See text in the right column: "Send this info to my phone". This opens a model box and presumably submits the form to self.

I have a form working now that properly submits a msg to a cell phone.

There is text "Added 'Submit to self' option to Show HTML action" per this topic. Problem is I downloaded the latest version and can find NO 'Submit to self' option within the Show HTML action. Where is that?

Is there any other issues I need to research when submitting a form to self? Any pointers or links greatly appreciated.

Thanks Bob!
PS Validated for 5 domains, and for the power of this software, level of expertise, and quality of support, you SHOULD TOO!
GreyHead 25 Oct, 2012
Hi cubefree,

I've been putting this off because I can't test any of it but here's my starter for ten . . .

Download the Twilio PHP package (Not the Joomla! one) from here

Unzip the package, rename the contained folder from something like 'twilio-twilio-php-b7a8d41' to just twilio.

Create a new folder components/com_chronoforms/extras and upload the twilio folder there.

Create a very simple new form with just a Submit button; a Show HTML action in the On Load event and a Custom Code action in the On Submit event.

Open the Custom Code action and paste this code (slightly modified from the Twilio example here )
<?php
	/* Send an SMS using Twilio. You can run this file 3 different ways:
	 *
	 * - Save it as sendnotifications.php and at the command line, run
	 *        php sendnotifications.php
	 *
	 * - Upload it to a web host and load mywebhost.com/sendnotifications.php
	 *   in a web browser.
	 * - Download a local server like WAMP, MAMP or XAMPP. Point the web root
	 *   directory to the folder containing this file, and load
	 *   localhost:8888/sendnotifications.php in a web browser.
	 */
	// Include the PHP Twilio library. You need to download the library from
	// twilio.com/docs/libraries, and move it into the folder containing this
	// file.
	require JPATH_SITE.'/components/com_chronoforms/extras/twilio/Services/Twilio.php';

	// Set our AccountSid and AuthToken from twilio.com/user/account
	$AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
	$AuthToken = "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY";

	// Instantiate a new Twilio Rest Client
	$client = new Services_Twilio($AccountSid, $AuthToken);

	/* Your Twilio Number or Outgoing Caller ID */
	$from = 'NNNNNNNNNN';

	// make an associative array of server admins. Feel free to change/add your
	// own phone number and name here.
	$people = array(
		"4158675309" => "Johnny",
		"4158675310" => "Helen",
		"4158675311" => "Virgil",
	);

	// Iterate over all admins in the $people array. $to is the phone number,
	// $name is the user's name
	foreach ($people as $to => $name) {
		// Send a new outgoing SMS */
		$body = "Bad news $name, the server is down and it needs your help";
		$client->account->sms_messages->create($from, $to, $body);
		echo "Sent message to $name";
	}
?>

Edit this file to add valid Twilio account details and a valid $people entry.

Save the form, submit and see what happens. I get an exotic error that goes away if I comment out the $client->account->sms_messages->create() line so I'm assuming that its because I have no valid Twilio IDs.

If you get that working then it should be fairly easy to link it to 'real' form data.

Bob
cubefree 25 Oct, 2012
Yes, I ended up using the normal library as well, not the Joomla one.

I realized now that the Modal solutions works really well, because I can post to the separate PHP form that stays in the modal box.

That's why I wanted to submit the form to self (tho still did not find it), but the modal solution works great.

Thanks Bob
GreyHead 26 Oct, 2012
Hi cubefree,

Please check the 'Submission event' options on the Advanced (Multi-page) tab of the Show HTML action. Whether the 'Self' option does what you want I'm not sure though.

Bob
This topic is locked and no more replies can be posted.