/    Sign up×
Community /Pin to ProfileBookmark

Populate fields via javascript

I have few hidden fields which should become visible on click of a link.

Below is the html code
<table>
<thead>
<tr><th></th></tr>
</thead>
<tbody>
<tr>
<td align=”center”>
<span id=”hoverspan”>
<a href=”#” onclick=”DisplaySelectedPart(‘1’)”><label id=”internalNumber”>121334</label></a></span>
<input type=”hidden” name=”shipmentDetails.lineItems.part.mfgNumber” value=”345245″ id=”part.mfgNumber1″/>
<input type=”hidden” name=”shipmentDetails.lineItems.part.description” value=”red and blue chicken sweaters out of graphite” id=”part.description1″/>
/// This is loop so on click DisplaySelectedPart function , i want to display these loop values into different elements on screen.
<input type=”hidden” name=”shipmentDetails.lineItems[1].attachments[1].fileName” value=”1.txt” id=”fileName1″/>
<input type=”hidden” name=”shipmentDetails.lineItems[1].attachments[2].fileName” value=”2.txt” id=”fileName1″/>
</td>
</tr>
</tbody>
</table>

I have written javascript function
function DisplaySelectedPart(ind) {
var internalpn=”part.internalNumber”+ind;
if(document.getElementById(internalpn).value !== null )
{
document.getElementById(“internalPartNumber”).value=document.getElementById(internalpn).value;
}
var pmfgnum=”part.mfgNumber”+ind;
if(document.getElementById(pmfgnum).value !==null)
{
document.getElementById(“mfgDistPartNumber”).value=document.getElementById(pmfgnum).value;
}
var pdesc=”part.description”+ind;
if(document.getElementById(pdesc).value !==null)
{
document.getElementById(“description”).value=document.getElementById(pdesc).value;
}
var fname=document.getElementById(“fileName”+ind);
if(fname !=null && typeof fname !== “undefined” && fname.value !== null)
{

var jsVar = ‘<s:property value=”#urlTag”/>’;
document.getElementById(“attachment.fileName”).value=fname.value;
document.getElementById(“pdfName”).value=fname.value;
jsVar=fname.value;
}
}

My problem , i want to populate hidden attachment list which can contain any number of fileName into html fields via javascript.
Please guide me.

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @kumar1234 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...