Skip to main content

Timeline for Pre populate a text input field

Current License: CC BY-SA 3.0

9 events
when toggle format what by license comment
Feb 20, 2013 at 18:08 comment added Paul Frost I've now installed CP CSS & JS extension, but am not sure if it's a good idea to put all my Custom field JS there or in each individual instruction field. It seems a bit remote and hidden from where it's affecting. But may be easier to maintain.
Feb 20, 2013 at 12:09 comment added Paul Frost Thanks Alex I wanted to be able to insert multiple lines and needed to add a line break, so after a bit of trial and error I found that this works: <script type="text/javascript"> $(document).ready(function() { if ($('input[name="entry_id"]').val() == '0') { $('#field_id_23').val('1st default text line'+'\n'+'2nd line'+'\n'+'3rd line'); } }); </script> not sure if this is the best method though.
Feb 19, 2013 at 21:57 vote accept Paul Frost
Feb 19, 2013 at 20:24 history edited Alex Kendrick CC BY-SA 3.0
deleted 3 characters in body
Feb 19, 2013 at 20:18 history edited Alex Kendrick CC BY-SA 3.0
mention a potential gotcha
Feb 19, 2013 at 20:07 history rollback Alex Kendrick
Rollback to Revision 2
Feb 19, 2013 at 20:06 history edited Alex Kendrick CC BY-SA 3.0
typo
Feb 19, 2013 at 19:59 history edited Alex Kendrick CC BY-SA 3.0
adding alternate method in case input fields need to be saved as empty
Feb 19, 2013 at 17:47 history answered Alex Kendrick CC BY-SA 3.0