• 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: how to add prefix text to unique submission id

how to add prefix text to unique submission id 3 years 1 month ago #41945

  • erikkock
  • erikkock's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
I have custom hidden that creates a unique submission id number.
How can i add a prefix to the number, e.g. test-

I set the field's DEFAULT value using this code:
//<code>
$db=JFactory::getDBO();
$db->setQuery("SELECT MAX( CAST( `FieldValue` AS UNSIGNED ) ) cnt FROM #__rsform_submission_values WHERE FieldName='ID' AND FormId=35");
$db->query();
$result=$db->loadResult();
return intval($result)+1;
//</code>


Then in the PHP script area "Script called on form process." I set the field's value AGAIN, with this code:
//<code>
$db = JFactory::getDBO();
$db->setQuery("SELECT MAX( CAST( `FieldValue` AS UNSIGNED ) ) FROM #__rsform_submission_values WHERE `FieldName`='ID' AND `FormId`=35");
$input = $db->loadResult();
 
if ($input) {
	$_POST['form']['Application ID'] = intval($input) + 1;
}
//</code>
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!