Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Streda, 25. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  getElementById does not work

phpMyEdit General     getElementById does not work
Odoslať novú tému   Odpovedať na tému    
 
praeparo     Založený: 10.10.2008   Príspevky: 2  
Príspevok Zaslal: 2008-10-10 15:30
Návrat hore  Odpovedať s citátom     

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     Založený: 10.10.2008   Príspevky: 2  
Príspevok Zaslal: 2008-10-10 15:57
Návrat hore  Odpovedať s citátom     

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     Založený: 17.12.2003   Príspevky: 236  
Príspevok Zaslal: 2008-10-10 20:07
Návrat hore  Odpovedať s citátom     

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.

 
Odoslať novú tému   Odpovedať na tému    

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov