• 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: Display form title

Display form title 10 years 2 months ago #30569

I am using a "$formLayout" script to show a message when a specific number of submissions are reached on that form. So far so good.

But, besides that, above the message I want to show the form title. I added the following to the "$formLayout" part:

global $database;
$database = JFactory::getDBO();
$sql = $database->setQuery("SELECT ('FormTitle') FROM #__rsform_forms WHERE `FormId`='".(int) $formId."'");
$result = $database->query($sql);
 
$row = $result->fetch_assoc();

To display the result I used the following code:
echo '<div class="componentheading"><h2>' .$row['FormTitle']. '</h2></div>'

This gives me the following title: "FormTitle" which is only the columnname in the database table. It doesn't give me the needed value in it...

What is going wrong here?
The administrator has disabled public write access.

Display form title 10 years 2 months ago #30571

After a long search I finally almost found it!

Replaced the database lookup part by this:
global $database;
$database = JFactory::getDBO();
$query = $database->getQuery(true); 
$query->select('FormTitle') 
      ->from($database->quoteName('#__rsform_forms')) 
      ->where($database->quoteName('FormId').'=16'); 
$database->setQuery($query); 
$result= $database->loadResult(); 

Now, the only last little thing i need to accomplish is to get the form ID automatically by using
'".(int) $formId."'

How can I fit that into this instead of '16'?:
->where($database->quoteName('FormId').'=16');
Last Edit: 10 years 2 months ago by svenleeman.
The administrator has disabled public write access.

Display form title 10 years 2 months ago #30572

Ok... once again, after another search i've found another approach to reach my goal:
$database = JFactory::getDBO();
$database->setQuery("SELECT `FormTitle` FROM #__rsform_forms WHERE `FormId`='".(int) $formId."' LIMIT 1");
$result= $database->loadResult();

And now it gives me the needed value!
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!