Custom field placement

I’d like to convert the text field for a custom field I created. I’ve tried copying and modifying the code from another field but I am getting errors. Any help on this is appreciated!

Sorry that your request was moved. Here’s the new link: https://development.invoiceplane.com/browse/IP-163

And you can test this code: http://www.codeshare.io/ir6RY

I cut and pasted the code you referenced, but it produced a blank page.

Then revert it.
Could you take a look what the id of the custom field is? Maybe I copied the wrong one.

I checked. It seems to be spelled correctly. I was able to insert each custom field (I only have two) individually. My problem now is that when I enter data into it and save the invoice, the data I entered doesn’t show in the field. Here is the code that i used using the other custom field (Reference No.) in my screenshot above.

<input type="text" id="invoice_custom_reference_no"
                                   class="input-sm form-control"
                                   value="<?php echo $invoice->invoice_custom_reference_no; ?>" >

Am I missing anything?

What does the system outputs for invoice_custom_reference_no?

Are you saying that the syntax is correct and should perform as I expect it to?

Hmm… Pretty wird.

Are you saying that the syntax is correct and should perform as I expect it to?

I just asked myself why the custom field does not display anything.

I looked into it further. The issue seems to be that on a new invoice, the custom field will allow input and will display that input upon saving. However, after saving, any subsequent edits do not save in the database and therefore do not show on the custom field on screen.

@Kovah: what could be wrong?

@Jadaw1n: I would love to get your thoughts on this…

Which version are you using?
Your screenshot in the jira issue shows the custom fields in the box to the right, but at least on 1.1.2 the fields are on the bottom of the page.
If this is a customisation => no problem. If you’re using an older version, please consider updating.

I’ll try this now…

Alright, the ajax save function for the custom fields does not accept a textarea by default.
In the file application/modules/invoices/views/view.php
on line 46 (v1.1.2) there is this code:
custom: $('input[name^=custom]').serializeArray()
Replace it with this code:
custom: $('[name^=custom]').serializeArray()

My modified loop for the custom fields (line 256): http://www.codeshare.io/fWwD0

I’m using v. 1.1.0. Which line do I need to modify then?

Should be similar, just search for the string in the same file.

I was able to find the custom: $('input[name^=custom]').serializeArray() line and replace it. I also replaced the loop for custom fields with your code. The field is now changed to a text area but when I save it, the changes don/t appear in the field for that particular field only. All other custom fields in the invoice view are able to save and reflect any changes.
`

Can you show me the whole file with your modifications?

@Jadaw1n: sorry for the late reply. I am currently overseas so I will have to send you the file when I get back in the next few days. Also, would you know if there is an easier way to work it in v. 1.2?

afaik there’s no improvement in this part. But I’m not up to date, don’t have too much time right now :frowning: But if you send me the file I’ll see what I can do.