Dynamically select option in select and radio form elements

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
mattyboi
Forum Commoner
Posts: 34
Joined: Mon Feb 06, 2006 9:42 pm

Dynamically select option in select and radio form elements

Post by mattyboi »

Hey guys, got another one for ya.

I have a form with the element values being populated dynamically by fields in a database table. In this form there are some select and radio elements.

How would I have the select element select the appropriate option based on the table when the page loads. The same for the radio element.

Thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

dynamically (in the page's source from the php side) add selected="selected" and checked="checked" to the corresponding option or radio button respectively.
mattyboi
Forum Commoner
Posts: 34
Joined: Mon Feb 06, 2006 9:42 pm

Post by mattyboi »

feyd wrote:dynamically (in the page's source from the php side)
I'm not quite sure what you mean by this.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Post Reply