2

I have this situation wherein input fields only appear in the edit form when they are toggled as active in database set-up. Any ideas on how to implement Jquery/AJAX on those fields? For example, i have a dynamic field drop down list. Once a value is selected, another dynamic field drop down list will be populated depending on the first selection.

Here is the scenario:

LastName, FirstName are original form fields

Dynamic Fields are : Address Type.

I can use the Id for LastName & FirstName but How do I use the Id of the Address Type which is only displayed / generated depending on its status in the set-up? and How will I know that the trigger for Address Type is called?

comments are suggested and pardon me for the explanation I can't explain it clearly because I am new to AJAX and JQuery

1 Answer 1

2

You need to associate the events when the fields are created. For example:

$('<input type="text" name"address" id="myAddress" />').keypress(function() { //do some things when keypress in address field }).appendTo('#myForm'); 
2
  • I generate my form in the PHP code. I can't try your approach. Commented Dec 18, 2014 at 8:22
  • Then simply add the event directly to the element: $('#myAddress').keypress(...). api.jquery.com/category/events for more information Commented Dec 19, 2014 at 12:30

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.