• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Unique Registration Script Enhancement?

Unique Registration Script Enhancement? 15 years 7 months ago #8411

  • servicefly
  • servicefly's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 22
  • Thank you received: 1
I need a script similar to the Unique Registration Script given in the User Guide.

What I'm trying to do:
I have a single textbox form called "Invitation Code." The textbox name is "invcode." I need visitors to be able to enter a specific code from one of many mailer (invitations), then be directed to a specific page (internal link) based on this code. The unique registration script does half the work of validating the code (invitation key) but I need to be able to replace the {invcode:value} in the return url with a url defined in the script that matches the code (invitation key) in the return url. Thanks for any help.
The administrator has disabled public write access.

Re:Unique Registration Script Enhancement? 15 years 7 months ago #8514

  • servicefly
  • servicefly's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 22
  • Thank you received: 1
So far I have learned that hidden fields with the name being the code and the value being the redirect is necessary. I have not yet found the php script changes to the validation script or a php redirect script which works. When I do, I will post it here.

I really wish I had realize that script support wasn't available with RSForm Pro, would not have purchased the license.
The administrator has disabled public write access.

[SOLVED] Unique Registration Script Enhancement? 15 years 7 months ago #8516

  • servicefly
  • servicefly's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 22
  • Thank you received: 1
Thanks to Alexandu (Tech Support) I now have the script I need to accomplish the multiple redirect.

To restate, my need was a single textbox form where visitors could input a 6 character code into the form which would redirect them upon submission to a specific page in our website. Here is what was done:

1. Create hidden field called "return" with no value.
2. Place the below script in the "Script called on form process " box:
$i=0;
$return = array('input url1 here','input url2 here','input url3 here');
if(isset($_POST['form']['textbox field name']))
{
	$validCodes = array('code 1','code 2','code 3');
	$foundValid = false;
	foreach($validCodes as $validCode)
		{
			if( strtolower($validCode) == strtolower($_POST['form']['textbox field name'])) 
				{
					$foundValid = true;
					$_POST['form']['return'] = $return[$i];
				}
			$i++;
		}
	if(!$foundValid)
	{
		$invalid[]=RSresolveComponentName('textbox field name',$formId);
		echo RSshowForm($formId, $_POST['form'], $invalid);
	}
}

3. Replace appropriate labels in script with actual data; url1, url2, url3, linked to code 1, code 2, code 3. Example, code 1 redirects to url1.

4. Replace textbox field name with actual field name.

You now have a multipage redirect form based on textbox input!
The administrator has disabled public write access.

Re:[SOLVED] Unique Registration Script Enhancement? 15 years 6 months ago #8807

In case someone else finds this and sees it doesn't work QUITE right, There is a step 5 that needs to occur:

5. put "{return:value}" into the Return URL field on the Edit Form tab of the form itself.

If you forget this step, it will not redirect your form anywhere. This step is key because just having the hidden "return" field doesn't make it redirect. From what I've found, there is NO direct access to the ReturnURL field on the form editor when you are submitting a form. There is a way for you to make the form bypass submission altogether and redirect elsewhere WITHOUT saving data, but there's no way to alter the returnURL directly in code.

the above addition does make this solution work perfectly!
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!