Hi
The US format for address is more compact than the international formats for data entry - which I prefer. For Australian purposes, I would like the following minor changes to the US format:
1. Rename City to Suburb
2. Rename Zip to Postcode
Would it be possible (or good idea) to have some jquery to make these changes?
Alternatively, I can create my own address format with text fields, but wouldn't trying jquery for this if someone can provide some points on the coding.
Regards
Adrian
1 Like
Great Adrian
Deleted my earlier comment about where to put it.
I already had some javascript code in there to name files uploaded to attachment so i have just added to it
$(document).on('knack-view-render.any', function(event, scene, view, data) {
$("a.kn-view-asset").html("Attachment");
$(".kn-input-address label[for='city']").text("Suburb");
$(".kn-input-address label[for='zip']").text("Postcode");
});
Hi Ray
The app builder has an API & Code menu that is specific to the App that you are maintaining.
In the same area you can play with the CSS.
Hooray!
Got it working after finding a similar answer from another forum post.
The following javascript works perfectly for me:
$(document).on('knack-scene-render.any', function(event, scene) {
$(".kn-input-address label[for='city']").text("Suburb");
$(".kn-input-address label[for='zip']").text("Postcode");
});
Acknowledgements to:
https://support.knack.com/hc/en-us/community/posts/220703128-Replacing-address-hint
Have no idea Adrian , far from JavaScript expert. It must be embedded somewhere perhaps within the standard CSS of knack. Not sure if can be overridden.
Thanks - do you know if it would be possible to simply replace the text "City" / "Zip" with "Suburb" / "Postcode" using jquery?
YES right with you on this one.
Obviously a pre designed address type does a good job although international format is kinda freaky with too many address lines, but allow us some control over specific formats.
i.e Set your location to Australia in our case would inherit field lengths and naming conventions such as Postcode 4 chars , State 3 chars
Hi
I've highlighted in the HTML the values I am looking to change.
<label class="help" for="city">City</label>
would need to become:
<label class="help" for="city">Suburb</label>
and
<label class="help" for="zip">Zip</label>
would need to become
<label class="help" for="zip">Postcode</label>
Thanks again
Adrian