• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

XSLT problem with javaScript removeAttribute()

 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am attempting to have a read only text box until another text box is changed. onChange for the second text box, the javaScript is called to remove the readonly attribute. The function is called but the box remains unwriteable. What am I missing?

XSLT declaration:
<input type="text" id="mdr_phone" name="mdr_phone" size="40" maxlength="60">
<xsl:attribute name="value"><xsl:value-of select="//mdr/mdr_phone" /></xsl:attribute>
<xsl:attribute name="readonly"><xsl:value-of select="readonly" /></xsl:attribute>
</input>

function call:
<input type="text" id="mdr_name" name="mdr_name" size="40" maxlength="60">
<xsl:attribute name="value"><xsl:value-of select="//mdr/mdr_name" /></xsl:attribute>
<xsl:attribute name="OnChange">
ChangedMDR('mdr_phone');
</xsl:attribute>
</input>


function ChangedMDR(otherID) {
var myOtherItem = document.getElementById(otherID);
myOtherItem.removeAttribute("readonly");
}
 
Marshal
Posts: 27214
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One thing you are missing: the fact that the Javascript was generated by XSLT is irrelevant. If your Javascript doesn't work, then figure out why, figure out what Javascript would work instead, then fix your XSLT to generate that instead.

So the first step would be to post the actual Javascript generated by that code and let people help you figure out why it has that problem. I will move the post to the Javascript forum and you can help out by posting the actual Javascript.
 
Darryl Failla
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The actual javascript is the last four lines of the message:

function ChangedMDR(otherID) {
var myOtherItem = document.getElementById(otherID);
myOtherItem.removeAttribute("readonly");
}
 
Paul Clapham
Marshal
Posts: 27214
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And the generated <input> elements?
 
Darryl Failla
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have found it to be a case sensitivity issue; "readOnly" instead of "readonly".
 
Not so fast naughty spawn! I want you to know about
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic