Hi all, first off:
Im new here, not very experienced in ModX so please go easy on me
Second:
If this is the wrong forum for this question feel free to move it.
Now for my question:
Im exploring ModX a bit, i have some PhP experience but not a whole lot in ModX.
When im just working with PHP on a website i sometimes use this script to create an easy contact form:
http://www.dagondesign.com/articles/secure-php-form-mailer-script/
Its very simple and straight forward to use, now im getting in to ModX, and i want to use this script with it, but with a slight add-on.
The easy thing about this script is, it has a bunch of options like this:
// RECIPIENT DATA
// If you are just sending email to a single address, enter it here. For more advanced
// usage such as multiple recipients, CC, BCC, etc.. please see the web page for instructions
$recipients = '[email protected]';
// FORM STRUCTURE
// This is used to generate the form. Each form element must be on its own line.
// Detailed usage instructions can be found on the web page
$form_struct = '
type=text|class=fmtext|label=Name|fieldname=fm_name|max=100|req=true
type=text|class=fmtext|label=Email|fieldname=fm_email|max=100|req=true|ver=email
type=text|class=fmtext|label=Subject|fieldname=fm_subject|max=100|req=true
type=text|class=fmtext|label=Telnummer|fieldname=fm_telnummer|max=100|req=false
type=verify|class=fmverify|label=Verify
type=textarea|class=fmtextarea|label=Message|fieldname=fm_message|max=1000|rows=6|req=true
';
That basicly tells the script to what email adress the email should be send, and what textfields/textarea's to create.
Now what i would want to do is the following:
I want to be able to fill in stuff like email adress and textfields in the manager.
So what ive done is use migx to create 2 template variables, one where you can fill in the name for the textfield/textarea and one where you can choose what the input type should be (textfield or textarea)
http://i43.tinypic.com/1pw01s.jpg (its in dutch but just to give an idea of what im talking about).
Now im able to sort of retrieve all of the options given in that menu and put them on a page in html. Like this:
migxHugo
[[getImageList? &tvname=`migx_contact_hugo` &tpl=`migxHugoTpl`]]
<form>
<input name="cf_submit" type="submit" value="Verstuur" />
</form>
and
migxHugoTpl
[[+type:is=`textfield`:then=`type=text|class=fmtext|label=Name|fieldname=field[[+idx]]|max=100|req=true`]]
[[+type:is=`textarea`:then=`type=text|class=fmtext|label=Name|fieldname=field[[+idx]]|max=100|req=true`]]
Dont mind the name, its for testing purposes.
Now thats all good and well, but now i want to be able to retrieve the options given in the migx menu, and pass them into the php script ive posted.
so to summarize a bit:
if there are 2 textfields in the migx menu i want:
[[+type:is=`textfield`:then=`type=text|class=fmtext|label=Name|fieldname=field[[+idx]]|max=100|req=true`]]
to generate:
type=text|class=fmtext|label=Name|fieldname=fm_name|max=100|req=true
and to put it in the snippet (where ive past the php code) so that it can be used to generate the form.
Hope ive been a bit clear of what i would like to achieve and i hope some of you could help me, because im pritty much stuck here.
Thanks so much in advanced!
Greetings, Thierry Vredeveld
[ed. note: thierryv last edited this post 14 years, 11 months ago.]