Select list from a proeviously given textfield

  • gtgt
  • Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 34
  • Thank you received: 1

gtgt replied the topic: Select list from a proeviously given textfield

Dear Michaela,

Thanks for your help.Your code works well. I tryed to adapt it to a very similar form, but I could not manage it. The adaptation was not succesful.

That is a bit more difficult stucture, because the option1... option4 field generated by another fields tex fields.

misterycity.com/mistery-city-adventure-e...mistery-city-piclist

Do you have any idea what els should be changed?

Thanks in advanced.
#232518
  • Posts: 2147
  • Karma: 75
  • Thank you received: 277

mihaela replied the topic: Select list from a proeviously given textfield

Hello again,

In case the fields option1... option4 in that other form aren't changed manually, but generated by another textfields, setion Actionscript on change won't work properly.

That is why would suggest that you implement the code the following way:
Navigate to your form's Advanced options > More options > Scripts and in the Initialization script section set Type to Custom.

In the code area below put code similar to this:
function ff_formname_init()  {
   setInterval(setlist, 500);
} // ff_formname_init

function setlist() {
   var list = ff_getElementByName('answer_01');
   for (var i = 1; i <= 4; i++){
           list.options[i] = new Option(ff_getElementByName('option'+i).value, 
          ff_getElementByName('option'+i).value, true, false); 
          }
}
NOTE: In the code above replace formname with the Name of your form.

Let me know whether you've managed to apply this and whether it worked properly.

Regards,

Mihaela
#232543
  • gtgt
  • Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 34
  • Thank you received: 1

gtgt replied the topic: Select list from a proeviously given textfield

Dear Michaela,

Sorry, it is not working. I have no problem with setting up the list, it is working well. I cannot select from the list.

Maybe an action script on the HELYES VALASZ element needed. There is a script on click, which fill the 4 options and it is work well. But if I select eny of the dropdowd it is not loaded...
#232945
  • Posts: 2147
  • Karma: 75
  • Thank you received: 277

mihaela replied the topic: Select list from a proeviously given textfield

Hello and Happy New Year,

Sorry for the late response, Crosstec Support staff was on collective holiday vacation, as noted in the forum.

I see where is the problem. The script I've provided defines select list options every half second so after you choose an option it will soon be reset because of explained.

You wrote "That is a bit more difficult stucture, because the option1... option4 field generated by another fields tex fields.". Because of the way textfields are filled in the solution for this is to add Actionscript to the elements that generate that textfields.

Add an Actionscript like this to each of the file upload elements:
function ff_uploadelementname_action(element, action)
{
    var list = ff_getElementByName('answer_01');
for (var i = 1; i <= 4; i++){
  list.options[i] = new Option(ff_getElementByName('option'+i).value, ff_getElementByName('option'+i).value, true, false); 

}
} // ff_uploadelementname_action
NOTE: In the code above replace uploadelementname with the Name of the file upload elements.

If you already have actionscript which fills the textfield with "HUBPdunakorzo_" content after the file upload element, be careful to put the code for filling in SELECT list after the code to fill textfield, otherwise it will try to fill empty value in the select list.

Let me know whether this worked as you wanted.

Regards,

Mihaela
#233047
Moderators: ForumSupporttomeperica
Time to create page: 0.063 seconds

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99€

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

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!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here