I have a standard Marketo Contact Us Form, that was created in Marketo Studio (typical drag and drop method) that is being used across multiple pages on a website. I have been charged with updating it to have the following dynamic logic:
> If "COUNTRY" picklist is selected and country value = US show "STATE" picklist > If "STATE" picklist is selected and country value = "CA" show "POSTAL" code input field.
I am able to accomplish this dynamic logic using the show() / hide() methods on a DIV ID via JQuery. The problem, I have is "HOW" to efficiently apply this update on the exisiting standard Marketo Contact Us form without having to create a new Contact Us Form this new dynamic logic. For example Marketo generates the following code for the STATE picklist:
Is this possible to do without creating a new contact us form and saving it as a template (This is the only place I know of where I have the flexibility to write custom code and modify Marketo's generated code e.g. add the DIV ID around the STATE picklist code etc.)
Thank you for you response. I think I figured it out. My solution was instead of depending on DIV IDs that I would create to make the show()/hide() logic work. I instead depend on IDs that Marketo generate automatically based on field names etc. Example....
.... #StateDisplay and #PostalDisplay are IDs I created....
I used, were I am calling the form element id directly.
** Please note on a side note, I had to also use a function to show/hide the generated form labels as well. The link below at at stackover flow was very helpful: http://stackoverflow.com/questions/16966140/find-html-element-by-content-and-hide-using-jquery
It's all about small victories :). Thank you for the feedback ...