I want to autocomplete a dropdown lookup field, based on the email address passed in the url, eg. https://www.the-domain.com/?pass_entry=xcbpr&email=test@abc.com
So the dropdown will have a list of entries from another form (Company, company email), but autocomplete/selected based on the domain name used in the email (so everything after the @).
So the lookup dropdown field on the form would be auto-selected as 'ABC', if they had a 'abc.com' email address.
Is anything like this at all possible?
It's possible with custom code called in this hook: https://formidableforms.com/knowledgebase/frm_setup_new_fields_vars/
Thanks, any pointers on how to get there? I've got stuck at getting the lookup to pull the correct company name based on the email to my form, let alone getting it to select this in the dropdown...
With what you need to do, you have to create your own function. It's probably easiest to write your own SQL select.
Hello, thanks, I have managed to sort the SQL query, but wondered if you could help with a JS function that would allow me to pre-select the dropdown.
Hidden field value="Company Name"
Dropdown value ="Company Name" selected
Any guidance?
I have this so far, but not working:
$(function() {
$('#field_rqyn8').change(function(){
$('#field_b3291').val('' + this.value);
});
$('#field_b3291').change(function(){
$('#field_rqyn8').val(this.value.replace(''));
});
});
The code I'm looking at requires a "change" function to occur after the page loads. If the hidden value doesn't change on page load then the code would not function at all. Also I see two change functions doing different things. I'm guessing the change function needs to go away completely.
You'll have the $('#field_rqyn8').val() set to a variable to get the value if this is the hidden field.
myVal = $('#field_rqyn8').val();
Then load that variable into wherever you want it to go (without a change function requirement).
myVal = $('#field_rqyn8').val(); //gets the value of the hidden field
$('#field_b3291').val(myVal); //sets the value of another field to the collected value in the previous step
$('#field_rqyn8').val(myVal); //sets the value of another field to the collected value in the previous step
Please login or Register to submit your answer