MAC Leasing Zeros - Truncated

JO3RI:
Hi PaulS,
@liudr, thanks man. I'm back with great ideas :smiley:

I didn't change a thing. I was nearly giving the code as is for now,

BUT ... I found a way around the problem:

<body>
: : : : : <input id="Button1" type="submit" value="SUBMIT" onclick="document.getElementById('Text2').value = hex2num(document.getElementById('Text1').value);document.getElementById <p>('Text4').value = hex2num(document.getElementById('Text3').value);document.getElementById('Text6').value = hex2num(document.getElementById</p> <p>('Text5').value);document.getElementById('Text8').value = hex2num(document.getElementById('Text7').value);document.getElementById('Text10').value = hex2num</p> <p>(document.getElementById('Text9').value);document.getElementById('Text12').value = hex2num(document.getElementById('Text11').value);" /></p> </form> </html> </body> > ``` > > > > When you save this piece of HTML to a test.html file you'll see that when you enter HEX values, the submit form converts them into DEC values and then submits them: PROBLEM SOLVED. <p>Issue with this code.</p> <p>Leading Zeros in MAC address field is truncated.<br> mac eg: 00 02 EF C0 FE</p> <p>becomes: 0 2 EF C0 FE</p> <p>Need help in fixing.</p> <p>-Sudheer</p>

Need help in fixing.

Nothing is broken. 0 is the same value as 00.

PaulS:
Nothing is broken. 0 is the same value as 00.

I used wrong words...!

mac is written in 2 digits, 00:02:EF:C0:FE

need to save mac as is with out tuncated zeros..

how to achive this.

need to save mac as is with out tuncated zeros..

Save it where? You are still operating under the assumption, incorrectly, that there is some difference between 0 and 00. There is not.

Sorry ! I am not clearly mentioning.

Eg: I have a arduino custom board which can save ethernet settings (to DHCP) and mac in EEPROM, these settings are changed using web interface.

mac : 00:02:EF:C0:FE , when I enter this mac in web interface and save, device should obtain IP from DHCP using configured mac (with out loosing leading zeros).
it.

I don't see any Arduino code here.

How to use this forum

with out loosing leading zeros

Why does this trouble you? Do you think 02 is a different number than 2?