close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

2 parts - Submit Select LABEL - on DYNAMIC form

Thread began 3/22/2010 3:57 pm by web_assist_mail157665 | Last modified 3/22/2010 3:57 pm by web_assist_mail157665 | 1263 views | 0 replies

web_assist_mail157665

2 parts - Submit Select LABEL - on DYNAMIC form

A bit of a puzzle this one

2 parts

ADDT dynamic form - ie you can edit 1,2,5, 10 at a time.

Form with Select Dropdown for COUNTIES
that inserts the ID into the database rather than the COUNTY NAME

ie 24 inserted into database KENT needs to be posted

I need to POST the COUNTY NAME which is in the Select Dropdown Label
when the MYSQL insert takes place and inserts the ID of the COUNTY into the DB


OK

I can get the Dropdown label by sending this function the Id of a Hidden Form Field I want to POST my value from and the Id of the Dropdown Select I want to get the label from....

<script type="text/javascript">
function disp_text(tg,obj)
{
var targ = document.getElementById(tg);
var el = document.getElementById(obj);
var idx = el.selectedIndex;
var selected_text = el.options[idx].text;
targ.value = selected_text;

}
</script>



AT FORM SUBMIT (A)
onsubmit="disp_text('hid_county','fk_id_cnty_evx_1');"
(note the value of the dynamic form suffix has to be hard coded - problem!)

OR (B), ON DROPDOWN CHANGE
onchange="disp_text('hid_county','fk_id_cnty_evx_<?php echo $cnt1; ?>');return false;"
(note I can use the $cnt1 value here to pick up the dynamic form suffix)

2ND Part

As the form is dynamic I can pick up the counter OK and correctly identify the correct form element (if someone changes the dropdown - B)


Problem - How can I work out the Counter Value of the form elements if they don't touch the select? - but edit 5 forms at a time

Option A - hard wires the _1 to the item name
this will only work when using 1 form
on a multiple insert or update it fails (obviously)

any ideas on how to deal with multiple forms and scenario A?

or is it just simple to force the user to use one form at a time - thats my fallback

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...