I have done some extensive googling on this but I can't find any advice. I'm quite new to the drupal community so I may just be looking in completely the wrong place. My apologies if this is the case.

I would like to add a block of custom HTML half way down my entity form. It contains an input (not within a form tag) and a button. Behind it is some jquery which hits an API and validates addresses.

I've got all this jq working, I just need to get it half way down the form. And if I just edit the code in the browser it works fine.

Here's my code that I want to drop into the form:


[first half of entity form]

 
(function($) { $('#postcode_lookup').getAddress({ api_key: 'xxxxxxxx', output_fields:{ line_1: '#edit-field-import-gen-addressline1-und-0-value', line_2: '#edit-field-import-gen-addressline2-und-0-value', line_3: '#edit-field-import-gen-addressline3-und-0-value', post_town: '#edit-field-import-gen-addressline4-und-0-value', county: '#edit-field-import-gen-city-und-0-value', postcode: '#edit-field-import-gen-postcode-und-0-value' }, onLookupSuccess: function(data){/* Your custom code */}, onLookupError: function(){/* Your custom code */}, onAddressSelected: function(elem,index){/* Your custom code */} }); })(jQuery);

[second half of entity form]

Any thoughts?

Thanks,
Tim.

Comments

timpwbaker created an issue.

tedbow’s picture

look at the hooks hook_form_alter and hook_form_FORM_ID_alter. you would need to put this is a custom module

The other option would to use the markup module. but I would recommend a custom module