javascript - How would I auto Populate a Input Text Box VALUE to be the same as the NAME? -


i working client needs forms show value inside of text box on form, system unable due how module coded.

what best way unable edit source code of form creation module allow value set automatically when user creates form.

i know there ways javascript done, have found require editing input boxes or placing styles / attributes on form not have access to.

i have pre-existing styles on these areas of code along wrapper around form target specific areas inside styling or script.

html example:

<form name="foobar">     <input name="my_name_1"/>     <input name="my_name_2"/>     <input name="my_name_3"/> </form> 

javascript:

function putnamesasvalues(formname){     var elements = document.forms[formname].elements;     for(var i=0;i<elements.length;i++)         if( elements[i].tagname.tolowercase().indexof('input') != -1 )             elements[i].value = elements[i].name; } putnamesasvalues('foobar'); 

usage:

the form name parameter in putnamesasvalues('foobar');


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -