This topic is locked

using javascript to write to a read only field

10/19/2007 9:50:31 AM
PHPRunner General questions
G
giles author

Hi,

I am using javascript to perform a reasonably complex price calculation. All is going well until I try to write the calculated value back to a read only field on the _edit page.
I have been able to get it to write to an editable text field on that same page....
The relevant bit of the javascript code is:
document.getElementById("value_Full_exc_Seals_SWT_Init").innerHTML= newprice
I've also tried the same thing with .value in place of .innerHTML
Here's the source view of the html for the read only field.....(note that commonfunctions.php was modified to insert the id attribute)
<TD class=editshade_b style="PADDING-LEFT: 15px"

width=150>Full exc Seals SWT Init</TD>

<TD class=editshade_lb style="PADDING-LEFT: 10px"

width=250><input type="Hidden" name="value_Full_exc_Seals_SWT_Init" id="value_Full_exc_Seals_SWT_Init" value="">

</TD>

As I said if I set the javascript up to write back to an editable field it works fine...The new price appears exactly where I want it to appear. Bit I can't use an editable field as the price has to be read only.
Anyone know how to get the js to write to the read only field?
P.S. I bought a year's support when I bought the upgrade to 4.1 earlier this month.(Oct 07). The support has been so good on this forum I haven't had to use it yet. But when I do (and this may be the one where I need it), how do I call on that support?

G
giles author 10/19/2007

Ok, at ease everyone....
May have found a solution in the forum <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=22389&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' /> ....enabling and disabling editable fields...can also see the readlony approach would not have worked as the values would not be written back to the db....
Will try that tomorrow...