using a third party created form in my app |
I used JotForm to create a form to use in my application. When I downloaded the "source code" it downloaded three things: 1) an html file 2) a css directory 3) a js directory. I want to makes sure that the new css doesn't interfere with my existing css.
How do I display an HTML file in CI? I will need to go into it programatically and update some of the fields from my table. How to do this?
proof that an old dog can learn new tricks
Just change the html extension to php.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(09-17-2020, 04:53 AM)richb201 Wrote: Thanks. I managed to get the form to appear following our instructions. Just finished a PDO version which is self contained. https://ci4-strict.tk/news/add_item?richb201 Notes: 1. Ensure the URL parameter is passed to see the View source file. 2. News->table nicked from https://codeigniter.com/user_guide/tutor...ction.html 3. Complete and submit the form - no validation yet ![]() 4. To see the entry, scroll to the bottom of https://ci4-strict.tk/news I have just used the basic PHP PDO scripts because I find it so much easier!
Thanks John. I am using CI3, not 4. Is that an issue?
I got the form to appear by changing the .html to .php and calling it via load_view(). I'd like to display it up here, but don't know what app to use to show it here. Anyway, I have a few fields that I need to modify on it before showing it to the user. Here is a section of it: <li class="form-line" data-type="control_checkbox" id="id_4"> <label class="form-label form-label-top form-label-auto" id="label_4" for="input_4"> Which of these Business Components did you work on? </label> <div id="cid_4" class="form-input-wide"> <div class="form-single-column" role="group" aria-labelledby="label_4" data-component="checkbox"> <span class="form-checkbox-item" style="clear:left"> <span class="dragger-item"> </span> <input type="checkbox" class="form-checkbox" id="input_4_0" name="q4_whichOf[]" value="Type option 1" /> <label id="label_input_4_0" for="input_4_0"> Type option 1 </label> </span> <span class="form-checkbox-item" style="clear:left"> <span class="dragger-item"> </span> <input type="checkbox" class="form-checkbox" id="input_4_1" name="q4_whichOf[]" value="Type option 2" /> <label id="label_input_4_1" for="input_4_1"> Type option 2 </label> </span> <span class="form-checkbox-item" style="clear:left"> <span class="dragger-item"> </span> <input type="checkbox" class="form-checkbox" id="input_4_2" name="q4_whichOf[]" value="Type option 3" /> <label id="label_input_4_2" for="input_4_2"> Type option 3 </label> </span> <span class="form-checkbox-item" style="clear:left"> <span class="dragger-item"> </span> <input type="checkbox" class="form-checkbox" id="input_4_3" name="q4_whichOf[]" value="Type option 4" /> <label id="label_input_4_3" for="input_4_3"> Type option 4 </label> </span> </div> </div> </li> I'd like to change, for example, "Type option 1" to a field from one of my mySQL tables. Where do I do this? Do I just add some <php></php> to the top of this .php (really .html) file? Can someone point me to a document that tells me how to replace some of those "value" fields? Should I embed some javascript (rather than php) in the top of the file?
proof that an old dog can learn new tricks
@richb201,
> Thanks John. I am using CI3, not 4. Is that an issue? I think the web-page should work on CI3. Try copying and pasting the DEBUG page content into a new view and see if it works. The News database requires and passwords require setting up in order to make it work. I have modified the script and it is now a lot more modular. https://ci4-strict.tk/news/add_item?richb201 I followed the supplied links and think the web-page is far too complicated and requires a lot of dependencies. I would be tempted just to use my simple template and add new items, CSS files, etc.
John, thanks for the help. I have a html file that I created with JotForm and renamed it as a .php file. I load it with load_view() and it is beautiful! Perfect. The only problem is that there are a bunch of radio buttons on it that I need create my own text for (and maybe add an additional button for). So I guess I could use the DOM. But I see that CI also has the form helper that will allow me to create a radio button in php. That is good because the text for these radio buttons is coming from a mySQL table. Can I just use the form_radio to add radio buttons to the existing html (now a php) file?
The question is "how to pass data between php and javascript without using XMLHttpRequest()" ?
proof that an old dog can learn new tricks
(09-19-2020, 11:24 AM)richb201 Wrote: John, thanks for the help. I have a html file that I created with JotForm and renamed it as a .php file. I load it with load_view() and it is beautiful! Perfect. The only problem is that there are a bunch of radio buttons on it that I need create my own text for (and maybe add an additional button for). So I guess I could use the DOM. But I see that CI also has the form helper that will allow me to create a radio button in php. That is good because the text for these radio buttons is coming from a mySQL table. Can I just use the form_radio to add radio buttons to the existing html (now a php) file?If you tried copying and pasting the script shown in the we-page is is a complete PDO example showing how to save and use render the database table values inside the web-page. I just stumbled across an article about using buttons and created a separate web-page on the site - remember to include the >richb20 parameter to see the PHP file source script: https://ci4-strict.tk/news/form_buttons?richb201 Regarding your previous post, please enclose your script inside [PHP...{/PHP] tags
John, interesting. I see that you are opening a new connection to the database with the password embedded in the code. I'd like to use $this->load->database();, since I have already made connection in the main part of my application. So my real issue is "how does fusion auth support passing an index to a user who has received a passwordless email"? So I realize that this may not be a CI question at all.
proof that an old dog can learn new tricks
@richb201,
The PDO button demo shows the script does work and that data can be entered and stored. Yes by all means use your own database connection instead of mine. I don't think CI4 has a PDO connection. I am not familiar with Fudion, Auth support and email, perhaps another user can help. I think it would be better to raise another thread. |
Welcome Guest, Not a member yet? Register Sign In |