Auto populate on page load
Permalink Browser Info Environment
Hi Team,
Love the add-on. Is there a way to populate a field on page load using html that I code into the "header extra content?"
For example, I want to use the same form on multiple pages, but I want one of the text boxes to populate with different informaiton based on code in the header extra content field.
Thanks for you quick response!
David
Love the add-on. Is there a way to populate a field on page load using html that I code into the "header extra content?"
For example, I want to use the same form on multiple pages, but I want one of the text boxes to populate with different informaiton based on code in the header extra content field.
Thanks for you quick response!
David
Type: | Discussion |
---|---|
Status: | New |
Awesome. This works. Thanks for the fast response. Just as a head's up...there was a slight error in the code. I moved the " ' " into the " ) " after The New Value. Code below works.
<script>
$(document).ready(function() {
$('.the-new-class').val('The New Value');
});
</script>
<script>
$(document).ready(function() {
$('.the-new-class').val('The New Value');
});
</script>
I assume this solution also work in pulling page names into the .val as getCollectionName(). I need to populate a select box with page names from beneath a particular page. I'm thinking that I would need to use a helper as well, but I'm not sure.
Or, from reading through the How-To's, maybe this...?
filterByParentID(array(pageId)); if ($num > 0) { $cArray = $pl->getPage(); } else { $cArray = $pl->get(); } ?>
On the Advanced Forms admin, edit the field and assign a unique value to Field CSS Class. Then on the page, add the following JavaScript (jQuery):
Where "the-new-class" is the class you specified and "The New Value" is the value you want to set.