Hi,
this one is very basic:
if i need to hand over some parameters by using a "hidden" type of input, how can i access this variables for proper use in "On Submit Code"?
e.g.:
Let's say i have something like this in the form HTML:
What has to be done in the "On Submit Code" fields to gain access to the value "XYZ"?
I know this is a Joomla! specific topic, but i am sure, it is of interest for many non-professionals like me, who want to realize basic stuff with ChronoForms.
Btw: i am talking about J!1.5
Thanks in advance,
Gekko
this one is very basic:
if i need to hand over some parameters by using a "hidden" type of input, how can i access this variables for proper use in "On Submit Code"?
e.g.:
Let's say i have something like this in the form HTML:
<input value="XYZ" id="doc" name="document" type="hidden">
What has to be done in the "On Submit Code" fields to gain access to the value "XYZ"?
I know this is a Joomla! specific topic, but i am sure, it is of interest for many non-professionals like me, who want to realize basic stuff with ChronoForms.
Btw: i am talking about J!1.5
Thanks in advance,
Gekko
<?php
echo $_POST['document'];
?>
should show the XYZđ
Cheers
Max
thanks for your *VERY* fast reply! đ
is there any difference between your method and something like this:
which of these two methods should be commonly used in terms of general compatibility issues?
Greetz,
Gekko
is there any difference between your method and something like this:
$id = JRequest::getVar( 'document', 'value');
echo $id;
which of these two methods should be commonly used in terms of general compatibility issues?
Greetz,
Gekko
Hi Gekko23,
The getVar method is preferred simply because it is a bit more secure. If you use $_POST you will get the raw submitted data and it's up to you to check that it doesn't contain any nasties. If you use getVar then Joomla can do some cleaning of the input data before it is returned from you. Better still is to use getString or getInteger which adds some type testing.
You can see the full range of JRequest methods here. I think that you can expect that future versions of Joomla will add more validation here.
Bob
The getVar method is preferred simply because it is a bit more secure. If you use $_POST you will get the raw submitted data and it's up to you to check that it doesn't contain any nasties. If you use getVar then Joomla can do some cleaning of the input data before it is returned from you. Better still is to use getString or getInteger which adds some type testing.
You can see the full range of JRequest methods here. I think that you can expect that future versions of Joomla will add more validation here.
Bob
it's amazing how fast and competent you guys respond to questions in this forum!
defenately worth a note insode the official extensions forums down there at joomla.org!
thanks alot!
one small topic related question:
is the content of the variable above ($id) disposable for other ChronoForms backend tabs like
'Email Template' or the 'Form Fields names' in the 'AutoGenerated code' tab?
i would like to have a dynamicly generated parameter (in my case it's an PDF file name) embedded both into the answering email text (so it must be put into the email template) and into the form related db entries.
Tricky:
i just transfer an document id via hidden input field to prevent the possibility to directly downloading a file by knowing it's name. Therefore, i have to determine the filename by OnSubmitCode (databasing), which works perfectly, but i also want to use this filename for that bunch of tabs mentioned above. So it is not a fieldname of the form, but generated after receiving the form data.
Is there a possibility to handle such db-resulting variables generated by 'OnSubmitCode' throughout the ChronoForms tabs processing?
I hope, this is understandable....=)
Greetz,
Gekko
defenately worth a note insode the official extensions forums down there at joomla.org!
thanks alot!
one small topic related question:
is the content of the variable above ($id) disposable for other ChronoForms backend tabs like
'Email Template' or the 'Form Fields names' in the 'AutoGenerated code' tab?
i would like to have a dynamicly generated parameter (in my case it's an PDF file name) embedded both into the answering email text (so it must be put into the email template) and into the form related db entries.
Tricky:
i just transfer an document id via hidden input field to prevent the possibility to directly downloading a file by knowing it's name. Therefore, i have to determine the filename by OnSubmitCode (databasing), which works perfectly, but i also want to use this filename for that bunch of tabs mentioned above. So it is not a fieldname of the form, but generated after receiving the form data.
Is there a possibility to handle such db-resulting variables generated by 'OnSubmitCode' throughout the ChronoForms tabs processing?
I hope, this is understandable....=)
Greetz,
Gekko
Hi Gekko23,
Any of the form data is available in OnSubmit Before, OnSubmit After and the Autogenerated Code box.
To handle a variable that's generated after submission put a dummy hidden field in your form like
Bob
Any of the form data is available in OnSubmit Before, OnSubmit After and the Autogenerated Code box.
To handle a variable that's generated after submission put a dummy hidden field in your form like
<input type="hidden" name="file_name" value="" />
Then set the value in the OnSubmit BoxJRequest::setVar('file_name', 'my_file', 'post');
Once this is done you can use the variable in the same way as any other Post variable.Bob
This topic is locked and no more replies can be posted.