I am working on a project and I have a glitch that I can not sort out and do not have anymore time to spend on it.
I have code that nearly works, but doesn't.... So I want a fresh approach.
I have been attempting to do this using Jquery UI dialogs, but it doesn't work...
I need a dialog that can be reused with varying content that can also properly display an editor on all text areas in the content. Currently the editor works the first time and never again or some permutation of insanity......
Must Work under with these requirements: Bootstrap v3.3.2, jquery v2.1.3. TINYmce 4.1.7
Top and side navs. The page content is in a div (#content) and is 80% of the page and that is ajax'd in.
What I need is a function that uses a dialog that accepts the following information:
action, url, buttons, content, title.
action - is to get or post the form
url - is where to perform that action to
title - for the dialog
buttons - what the buttons should say and any additional actions they should take,
e.g.: create a save button that then takes the action to submit the form to the url and display the results in the dialog
content - HTML of the new content for the dialog. An example of one form is below:
//(assume obj is valid and contains these items)
var content = '<form action="" id ="instructor_form" name="instructor_form"> ' +
'<input type="hidden" name="id" id="id" value="' + [url removed, login to view] + '"/> ' +
'<p> ' +
'<label for="first_name">First Name</label> ' +
'<input type="text" name="first_name" id="first_name" value="' + obj.first_name + '" /> ' +
'<label for="last_name">Last Name</label> ' +
'<input type="text" name="last_name" id="last_name" value="' + obj.last_name + '" /> ' +
'<label for="img">Image</label> ' +
'<input type="text" name="img" id="img" value="' + [url removed, login to view] + '" /> ' +
'</p> ' +
'<p> ' +
'<label for="bio">Bio</label> ' +
'<textarea name="bio" id="bio" value="' + [url removed, login to view] + '"></textarea> ' +
'</p> ' +
How and what will be sent to the dialog will vary so it should be called like so:
displaydialog(action, url, buttons, content, title);