• 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: Get formID in scripts section

Get formID in scripts section 4 years 10 months ago #40267

  • yolknet
  • yolknet's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 18
In the section "Script called before form is generated" I want to use the id of the form. What is the code line for this?
The administrator has disabled public write access.

Get formID in scripts section 4 years 10 months ago #40268

  • iceferret
  • iceferret's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 246
  • Thank you received: 64
See this link

If you create a hidden field 'formid' then set its default value to {global:formid} you can access it in the script area with
$val['formid']
If you can keep your head when all about you are losing theirs, then you obviously don't understand the situation!
The administrator has disabled public write access.

Get formID in scripts section 4 years 10 months ago #40269

  • yolknet
  • yolknet's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 18
Thank you for this tip.
But in this case the $val isn't filled yet.
The administrator has disabled public write access.

Get formID in scripts section 4 years 10 months ago #40270

  • iceferret
  • iceferret's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 246
  • Thank you received: 64
I carried out a little test by creating a text box 'formid' with the {global:formid} as before and putting the following into 'scripts processed before generation' it does output 'changed it' instead of the forms actual id. That suggests the formid global exists from the moment you create the form
$var = $val['formid'];
$var ='changed it';
$val['formid'] = $var;
If you can keep your head when all about you are losing theirs, then you obviously don't understand the situation!
The administrator has disabled public write access.

Get formID in scripts section 4 years 10 months ago #40275

  • yolknet
  • yolknet's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 18
I've created a hidden field with the value "{global:formid}". When the form is loaded the value is indeed the form id. But $val at "Script called before form is generated" is still empty.
What do you see when you place this code under "Script called before form is generated"

echo '<pre>';
print_r($val);
exit;

At this point I want to know the form ID because a custom script needs it.
When the rest of the form loads your solution works.
The administrator has disabled public write access.

Get formID in scripts section 4 years 10 months ago #40277

  • iceferret
  • iceferret's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 246
  • Thank you received: 64
Just an empty array()
If you can keep your head when all about you are losing theirs, then you obviously don't understand the situation!
The administrator has disabled public write access.

Get formID in scripts section 4 years 10 months ago #40278

  • yolknet
  • yolknet's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 18
Indeed. So the same problem as I have :-)
So how do you know the form ID at this point? Now take it from the non-SEF url, but this doesn't work when the form is used in a module. You can check for both, but that's extra lines of code. Maybe there is a much quicker way?
The administrator has disabled public write access.

Get formID in scripts section 4 years 10 months ago #40279

  • iceferret
  • iceferret's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 246
  • Thank you received: 64
Not that I know, sorry I couldn't help. Start a ticket they may have a simple answer for you.
If you can keep your head when all about you are losing theirs, then you obviously don't understand the situation!
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!