Jump to content

change dinamic form field


jason213123

Recommended Posts

hi,

i have many filelds on my site that i want change the value.

for example i have:

a link: "click here for change" with this code: -> linker (26,'field_name');

 

that call the javascript function

function linker ( id,field_name) {

 

document.field_name.value = id; <- here i want change the value

 

for the name of the field that i have said.

now i have try on some ways but i can´t find one that works

how can i do that?

thanks a lot for your help :)

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/202655-change-dinamic-form-field/
Share on other sites

You need to give more detail on what you want to do.... yes i know you want to change a link, but how? and do you want to change the link location or the text of the link?

 

And can you give examples of the links you want to change?

 

Also here is a few examples of stuff to look into or change about you function

function a_href_update( id, field_name ) {

document.getElementById(field_name).value = id; //here i want change the value
document.getElementById(field_name).href = new_url; //a href change url location
document.getElementById(field_name).value= new_text; //input element value change
document.getElementById(field_name).innerHTML= new_text; //a link element change text

// I find it confusing you have field_name & id, thats 2 location pointers and you only need 1.
// you only need 1 location pointer which generally ID= or Name= or ClassName=
// If you do the Name=/ClassName= you still got to go another step to identify location.  ID is generally best for a unique ID name.

// If you changing lots of links at once do yourself a favor and run it though a loop
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.