Site name

Welcome, Guest
Username Password: Remember me

Add a default value to a field
(1 viewing) (1) Guest
Support requests and general discussions
  • Page:
  • 1

TOPIC: Add a default value to a field

Add a default value to a field 24 Nov 2011 11:48 #2735

  • Rob
Hi, congratulations for the component, is fantastc¡¡.
But I need to catch a varible from the URL (by GET method is easy, this isn't the problem) and I need to create a new hidden input(with de variable value) and add it to de array field for send for mail. ¿How can I do it?.

(sorry for my english).

Regards.
Last Edit: 26 Nov 2011 21:24 by Fox.

Re: Add a default value to a field 24 Nov 2011 21:35 #2742

  • Fox
  • OFFLINE
  • Administrator
  • Posts: 2408
  • Karma: 72
Rob, I'm very sorry, but both your features (default values and hidden fields) are currently not supported by this extension.

I hope to add this features as soon as possible, but I can't tell when.
If you want to do it by yourself, take a look into fieldsbuilder.php (where you build form fields) and fmailer.php (where you read fields content and send the email)

This post will be moved under "feature requests" section.
If you use this extension, please post a rating and a review at the Joomla! Extensions Directory.
If a problem has been solved please let everybody know, it could be important for other people.
Last Edit: 24 Nov 2011 21:35 by Fox.

Re: Add a default value to a field 26 Nov 2011 18:10 #2767

  • dee
hi there, for everyone interested about it, i used the following solution:

as fox said, in fieldsbuilder.php i added in around line 177 inside "private function BuildTextField" just before ($result = '<div style="clear:both;">' .) the following code:
$autofillvalue=JRequest::getVar('autofillvalue');
if($autofillvalue) {
list($fieldname, $fieldvalue) = split('_', $autofillvalue);
if ($field['Name'] == $fieldname) { $value=$fieldvalue;	}
}


now if you link to your form, lets say by this url:
www.myweb.com/contactform?autofillvalue=Subject_My subject text here
you get the field by name "Subject" (or any other fieldname you enter right after the "=") prefilled with the value you enter right after the underscore "_"

you can add this lines of code also inside "private function BuildTextareaField" just before ($result = '<div style="clear:both;">' .) to autofill a text area field.

the question which remains for me, what i didnt understand while searching for an answer in this forum is:
why does a field i create and name "Subject" gets stripped from the emails? it seems like it is a non-usable / forbidden name for a form field??? any fix on this?

Re: Add a default value to a field 26 Nov 2011 21:29 #2769

  • Fox
  • OFFLINE
  • Administrator
  • Posts: 2408
  • Karma: 72
dee, this seems to be a great contribution. Thank you.

why does a field i create and name "Subject" gets stripped from the emails?

I think it depends on your email client.
I faced this problem here, but the user didn't tell us what email client he is using and if the solution proposed has fixed the problem.
If you use this extension, please post a rating and a review at the Joomla! Extensions Directory.
If a problem has been solved please let everybody know, it could be important for other people.
Last Edit: 26 Nov 2011 21:30 by Fox.

Re: Add a default value to a field 26 Nov 2011 22:03 #2772

  • dee
i just had a look at your link to the forum. i will answer there so this thread doesnt get stuffed with not related infos. cheers!

Re: Add a default value to a field 09 Jun 2012 08:48 #5593

  • hit7374
  • OFFLINE
  • Fresh Boarder
  • Joomla addict
  • Posts: 2
  • Karma: 0
works wonderful! many thanks.
just one thing to help
the field must be a text field not check or list and not required.
to configure it is very easy
send you a request with the foxform and choose the good field you need in the mail you receive [field] after as explain you write the good link.
index.php?option=com_foxcontact&view=foxcontact&Itemid=241&autofillvalue=field_the response of your choice
best regards

Re: Add a default value to a field 17 Dec 2012 13:45 #7410

  • Toeffe
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
  • Karma: 0
Hey

Great modification!!

But it is possible to make one hyper link, add a value too multiple fields?
(so if the user click's on a link i autofills two fields)

Re: Add a default value to a field 22 Dec 2012 00:46 #7450

  • gyroglm
  • OFFLINE
  • Moderator
  • Posts: 416
  • Karma: 21
But it is possible to make one hyper link add a value to multiple fields?
Anything is possible, if you do it yourself . Use the ideas in this thread and this one with multiple name=value tags.

Re: Add a default value to a field 07 Jan 2013 22:09 #7567

gyroglm wrote:
But it is possible to make one hyper link add a value to multiple fields?
Anything is possible, if you do it yourself . Use the ideas in this thread and this one with multiple name=value tags.


It's inncorect url - 0.0.0.1
  • Page:
  • 1
Moderators: dkinney9, gyroglm, rscott7706
Time to create page: 1.35 seconds