Button Onclick Issue
-
How can button onclick event change value on other field? I have a dropdown field where I want to change the value when buttons clicked.
For example: Drowndown has 3 value, A, B and C. and B is selected.
But there is another button end of the form, when clicked I want to change that drowndown value to A.
Please suggest, I have Developer version of your plugin. Thanks in advance.
-
Hello @mahfuzar
The process is very simple. Assuming the name of the dropdown field is: fieldname2, enter as the onclick event of button the following piece of code:
jQuery('[id*="fieldname2_"] option[value="A"]').prop('selected', true).change();
and that’s all.
Best regards.I have multiple options for same value. Like A is 3, B is 5, C is also 3
can I use data-i number somehow?Hello @mahfuzar
In this case you can use the “vt” attribute:
jQuery('[id*="fieldname2_"] option[vt="A"]').prop('selected', true).change();
If you need additional support, you should provide the URL to the web page where the form is inserted.
Best regards.
Unfortunately its not working, Here is the form https://fastpremium.ch/rent-calculator
on 2nd page the button says “SELECT THIS VEHICLE” is suppose to change the value to Audi R8 Spyder.Hello @mahfuzar
I’m sorry, you have no understood, the code would be:
jQuery('[id*="fieldname34_"] option[vt="Maserati Granturismo" ]').prop('selected',true).change();
as you can see, I’m using as the vt attribute the text of option to select.
Best regards.
Thank you so much, it works now! Is there a way I can pass value from other form to my calculator form?
Hello @mahfuzar
Please, visit the following links to know the way the form’s fields can be populated by default, and how populate them with the values submitted by another form created with the CFF plugin:
https://cff.dwbooster.com/documentation#populate-form
https://cff.dwbooster.com/documentation#populate-form-b-with-aNote: for features in the commercial versions of the plugin, you should to contact us through our private website:
https://cff.dwbooster.com/contact-us
Best regards.
Thank you, I will.
There is some issue with the button, it changes the drowdown field but not working for summary page.
If I manually change the dropdown it works fine, but changing through button does not pass the value to summary page. Can you please have another look for me? I appreciate this.Hello @mahfuzar
Please, move the onchange event to the select tag, as follows:
jQuery('[id*="fieldname34_"] option[vt="Maserati Granturismo" ]').prop('selected',true);jQuery('[id*="fieldname34_"]').change();
Best regards.
Thank you, It works perfectly.
There is no reply from that website which you referred, A ticket was opened few hours ago but no reply. Ticket #440013
I am trying to Populate data from one form to another and it’s not working. can you please help?
I used this code, but no luck
[CP_CALCULATED_FIELDS_RESULT]<script> cpcff_default = { 12 : {} }; cpcff_default[12][ ‘fieldname38’ ] = ‘<%fieldname38_value%>’; cpcff_default[12][ ‘fieldname39’ ] = ‘<%fieldname39_value%>’; cpcff_default[12][ ‘fieldname1’ ] = ‘<%fieldname1_value%>’; cpcff_default[12][ ‘fieldname9’ ] = ‘<%fieldname9_value%>’; cpcff_default[12][ ‘fieldname2’ ] = ‘<%fieldname2_value%>’; cpcff_default[12][ ‘fieldname10’ ] = ‘<%fieldname10_value%>’; cpcff_default[12][ ‘fieldname25’ ] = ‘<%fieldname40_value%>’; </script>[/CP_CALCULATED_FIELDS_RESULT]Hello @mahfuzar
The number to use in the block of code is not the form’s id, it is a consecutive of the number of forms in the page, starting in 1. In your case:
[CP_CALCULATED_FIELDS_RESULT]<script> cpcff_default = { 1 : {} }; cpcff_default[1][ 'fieldname38' ] = '<%fieldname38_value%>'; cpcff_default[1][ 'fieldname39' ] = '<%fieldname39_value%>'; cpcff_default[1][ 'fieldname1' ] = '<%fieldname1_value%>'; cpcff_default[1][ 'fieldname9' ] = '<%fieldname9_value%>'; cpcff_default[1][ 'fieldname2' ] = '<%fieldname2_value%>'; cpcff_default[1][ 'fieldname10' ] = '<%fieldname10_value%>'; cpcff_default[1][ 'fieldname25' ] = '<%fieldname40_value%>'; </script>[/CP_CALCULATED_FIELDS_RESULT]
Because there is only one form in the page.
For example, if there are two instance of forms in the page, the first form would have the number 1 and the second one the number 2 and so on.
Best regards.
ok
-
This reply was modified 5 years, 8 months ago by
Mahfuzar Rahman.
Hello @mahfuzar
Please, send the questions related with the features of commercial version of the plugin, only through my private website.
Best regards.
For pro or commercial product support please contact the author directly on their site. This includes any pre-sales topics as well.
As the author is aware, commercial products are not supported in these forums. I am sure they will have no problem supporting you there.
-
This reply was modified 5 years, 8 months ago by
- The topic ‘Button Onclick Issue’ is closed to new replies.