TOPIC:

How to set a Select List value to 'selected' 7 years 1 month ago #111497

  • Topic Author
  • aictcnm
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 2
  • Thanks: 0
Hello,

Could someone please help me out with a problem I am having trouble solving?

I am passing a variable through my URL to my forms page, such as:

mywebsite.com/form?var=Option1

And what I would like to do is set my select list field to be pre-set at 'Option1'. I have read through the forums and knowledge base and know that I have to put the following code into Form Manager > go to your form > properties > more options > form pieces > before form > custom:

$this->execPieceByName('ff_InitLib');
//fetch the url code
$mycode= JRequest::getVar('var');

//assign it to the form element
ff_setValue('dropdownlist' , $mycode );

The problem is it does not set the 'Option1' value to 'selected' and show it as the selected option in the dropdown box. It does work when I try to set a text field to the value passed but not a select list. Does anyone know how I can do this?

Thanks in advanced!

Nancy

Please Log in or Create an account to join the conversation.

How to set a Select List value to 'selected' 7 years 1 month ago #111694

  • chrisal's Avatar
  • chrisal
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 6983
  • Karma: 187
  • Thanks: 629
Hello aictcnm,

this is a little bit more complicated with select-lists.

Please have a look at this small sampleform. Possible Parameter values:
&var=1
&var=2
&var=3

You can find the code in the Before Form Piece and in the Init script of the textfield.

You can change the textfield to a hidden Input element of course.


File Attachment:

File Name: DefaultSelect.zip
File Size:6 KB



regards
Chris
Attachments:

Please Log in or Create an account to join the conversation.

How to set a Select List value to 'selected' 7 years 1 month ago #111798

  • Topic Author
  • aictcnm
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 2
  • Thanks: 0
Hi Chris,

Thanks so much for your help! Your sample form was very useful and I was able to get it to work on my form! :)

Thanks for the reply!

Nancy

Please Log in or Create an account to join the conversation.

How to set a Select List value to 'selected' 7 years 1 month ago #111829

  • chrisal's Avatar
  • chrisal
  • Offline
  • Ultimate Breezer
  • Ultimate Breezer
  • Posts: 6983
  • Karma: 187
  • Thanks: 629
Hello aictcnm,

thanks for your feedback. Let us know if you have further questions.


regards
Chris

Please Log in or Create an account to join the conversation.

How to set a Select List value to 'selected' 2 weeks 6 days ago #257706

  • tribal6
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 7
  • Thanks: 1
7 years later I am at the same point:
I need to set a dynamic default/selected on a select list (not dynamic) depending on a variable ($_SERVER[ 'HTTP_REFERER' ]) - but I can't import the example provided by @crisal in my BF-Installation (1.9.1 Stable (941)).

Does anybody has an installable export of such an example?

Read and adapt JS-/PHP-Code is not that problem, if the example does not perfect matching the needs :)

Kind regards
Roger

Please Log in or Create an account to join the conversation.

Last edit: Post by tribal6.

How to set a Select List value to 'selected' 2 weeks 6 days ago #257707

  • tihana.krivic's Avatar
  • tihana.krivic
  • Offline
  • Moderator
  • Moderator
  • Posts: 5361
  • Karma: 3
  • Thanks: 383
Hi,

here is this example:

File Attachment:

File Name: Beforeform.zip
File Size:7 KB


Please download->unzip->and install it (BF->Configuration->Package Installer->select this xml file->Install Package).

After that you will find form in Manage forms inside Package QuickModeForms

Regards,
Tihana
Attachments:

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Moderators: ForumSupport
Time to create page: 0.053 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!