| Index
» Projects
» phpMyEdit
» Forum
» getElementById does not work |
 |
praeparo
Joined: 10 Oct 2008
Posts: 2
Posted: 2008-10-10 15:30
Back to top
Reply with quote
|
I would like to read and set values within the form input boxes from javascript on the page. The problem is that the form inputs returned from the phpMyEdit($opts) only have the "name" tag which works OK in IE with the document.getElementById as it will match the name= but not in any other browser.
An example of what is currently generated:
<tr class="pme-row-1">
<td class="pme-key-1">Description</td>
<td class="pme-value-1">
<textarea class="pme-input-1" name="PME_data_description" rows="7" cols="80" wrap="virtual">????</>
Is there any way to have an id put on the form input elements or another way to read and populate the input boxes.
The above example would become:
<tr class="pme-row-1">
<td class="pme-key-1">Description</td>
<td class="pme-value-1">
<textarea class="pme-input-1" name="PME_data_description" id="PME_data_description" rows="7" cols="80" wrap="virtual">????</>
Thanks.
|
praeparo
Joined: 10 Oct 2008
Posts: 2
Posted: 2008-10-10 15:57
Back to top
Reply with quote
|
OK found a way without getID by scanning all the inputs on the form:
var inputs = document.getElementsByTagName('input');
if (inputs) {
for (var i = 0; i < inputs.length; ++i) {
if (inputs[i].name == 'PME_data_field') {
var myField = inputs[i].value;
}
}
}
If I have missed and easy option to do this please reply.
|
ajh
Joined: 17 Dec 2003
Posts: 236
Posted: 2008-10-10 20:07
Back to top
Reply with quote
|
The mce_cal extension adds id tags to all of the fields. You could use the extension without the mce or calendar editors to just get ids if you want.
|
|
Post new topic
Reply to topic
|
|
|
|