I am building a send/receive message system. The messages may be created, replied and forwarded. The same blade file is used for all of them. For creation, every field title, body, recipient, attachment is empty but for reply, the recipient is the sender of the message. In forward recipient field is empty. Different situations for fields may happen based on the action.
This is my question, Should I create different blade files for every action or based on the action, I should put if else statement in the blade file and create the corresponding field?
Both approaches have its own drawbacks. for different blade files, It is difficult to maintain the web site. for example changing a color or something in UI, requires changing in every blade file.
thanks in advance.
Related
I'm a beginner in Symfony and am using v5.0.11 as part of a work project (inb4: as its a work for the company I'm employed by, I have little control over updating the version).
My issue is the following: I have a controller (that extends the "CommonController") file that contains different routes leading to different URLs, supposed to be triggered by a multi-field form's button. The first route in this controller (except for the one leading to the main page) is "#Route: /global/search/" related to a "globalSearch funtion". The following routes (eg #Route: /global/product_code/{product_code}) are defined further down the document, indented at the same level and are located outside of that first "globalSearch" function.
Depending on the form's fields fill beforehand; it should send the user to a specific URL related to said field (eg: if I fill the "product code" category, it should send me to an address like "/global/product_code/{product_code}".
However, when I fill any field and press the button, it still sends me to the general search URL ("global/search") instead of the one I routed above '"global/product_code" for example.
Do you have any idea why that is ? I've gone down Symfony & Doctrine docs but couldn't find any answer for it; and from what I read I can't prioritize routes as I'm in 5.0.11.
Thanks in advance for any help.
NB: as my work concerns a sector and company bound by secret to my country's governement & multiple firms; I can't share the code online to 3rd parties; tho I will try to bring as many infos about the code as needed.
Without some code samples it would be hard to identify the problem and whether it's a problem at all.
But here are some ideas, how to narrow the problem down.
First:
However, when I fill any field and press the button, it still sends me to the general search URL ("global/search") instead of the one I routed above '"global/product_code" for example.
If you're using symfony forms to create and/or render forms, it's probably <form action=""> attribute. I assume it either blank (which will submit it to the same URL. In your case it's /global/search) or it is set to a specific route. (e.g /global/search )
In any case, you should consider #Cerads suggestion to check all available routes to find out more and find out which controller action is responsible for /global/product_code/{product_code}. If there are some routes matching this pattern, they have to have a "route name" so you could search in the whole project for that route name.
bin/console debug:router or bin/console debug:router | grep global
Second:
Depending on the form's fields fill beforehand; it should send the user to a specific URL related to
To somehow change submit-url by users-input requires JavaScript. Whether you send a single field value via AJAX or just "replace" form's action attribute, you have to check related JavaScript code.
I've been on DocuSign, google, and SO and can't find a combination of search terms to tell me what I want. Working in the API, is there a way to attach a couple of pieces of information to a recipient that would then belong to that recipient and be included in API callbacks?
For instance, I'm sending out four envelopes: signer, co-signer, dealer, salesperson. I'd like to attach a field to the recipient like "our_recipient_type" equal to one of those four values. That way, when DocuSign does a callback after someone signs, I get that piece of information in the JSON so I can easily close the loop on our side.
Note, I'm not talking about text tabs, not something the signer fills out. I'm talking about a piece of background information as a property of the object.
A simple solution would be to use text fields and have them with white font so they don't show in the document, but their values can be set/retrieved using the API.
A more advanced solution would involved custom fields (https://support.docusign.com/en/guides/ndse-user-guide-custom-fields) that can have more robust rules and can also be used to manage meta-data.
There are also envelope-level custom fields (text fields) that by definition do not show in the envelope and are meta-data for the entire envelope, not a specific recipient, but they can be used for this purpose as well if you want.
I think I understand the concept of HMVC after reading this question and answer https://softwareengineering.stackexchange.com/questions/220480/hmvc-and-database-connections; an extract from an answer is below:
Let's assume you want to have a view that enables a user to make a
comment to a blog post. You would have fields for name, e-mail, title
and comment, but you also want to have a field country displayed as a
dropdown. In the action that displays this view you would make a
database query that loads the countries and then populate that
dropdown. Which is ok, but it forces you to duplicate the query and
the view required to display the countries if you need it in another
part of your application. A better approach would be to create
separate controller for countries with an action that returns a view
with the dropdown and then render that action whenever you need to
show a list of countries.
What I cannot wrap my head around is that if I can internally request a controller/model/view which just displays a widget (e.g. a country select box), doesn't that mean that by accessing that url from a browser will also just show that view?
How is this managed in HMVC, are routes defined as internal/external only, so matching an internal route with an external request would show a 404 page?
Is this generally how it is done and is the HMVC description/definition above satisfiable with the general use case of it in most web applications?
Showing the output of a sub-request in the browser shouldn't be a problem, so I wouldn't bother, especially that those URLs are not known by the user and it's safe to output the widgets separately.
Despite the above, you could, as #deceze mentionned, not attach those controllers to any routes. If you have a "default" route (matching all requests), then you would have to disable it.
Has anyone faced this feature request and were able to resolve it? We have a webapps that is capable of creating a form as a template. That template will basically be called and user will need to fill out the form before it got push into the db. So the form is created directly inside the application and the fields, labels and variables are all defined when the form is created by user using the apps. Since the form is always going to be changing, I can't hardcode the activity in android and have to create it manually and recompile every time a new form is created. Is there a way for us to read the label, variables setting that's stored in db either in XML format or called as JSON and build the form dynamically everytime the form is called via android? Am I making any sense? Please advise?
Yes. Everything you do in XML (view creation, positioning etc) can be done dynamically via code as well.
A simple way would to be to put a single ScrollView with a single LinearLayout inside it. Then in your activities onCreate(), you can read your JSON or XML file just like any other file (you can store this is assets folder or maybe query it from your backend). Then depending on your variables you can initialize and add TextViews and EditText's to the LinearLayout. The ScrollView will expand infinitely to accommodate all your form elements.
Just make sure you don't do any long-running operation such as querying from your backend or reading from your file in the main UI thread. Another caveat is that if ScrollView does not recycle views and putting too many views in it (say more than 20) can make your application run out of memory and slow down/crash.
You can create a form in relative layout having all the fields/view you require in XML, then on Runtime in code According to your label name in db or whatever you are using, you can hide/show the fields/view which are needed dynamically. This way you can preserve the position and setting of each field as when 1 view is hidden other views are going to take its position.
I built a site using Drupal 6 recently that allows for users to submit information to the site owner in three different ways. They are:
Webform A: Quick Contact - this just collects name, email, phone and a message.
Webform B: Free PDF Book by Email Webform - this collects info similar to above, and then sends the user an email with a PDF attachment which is a book written by the site owner.
Node Create: Case Evaluation - this form is a Node Creation page using the Multi-Step module, CCK and a lot of conditional fields. Anonymous users can fill out this form and the node data is emailed to the site owner based on a Rule I created.
All three of these forms work perfectly in terms of doing what they are supposed to do for the site. The webform submissions are easily accessed from the webform node by the owner, and I set up a table view to manage the node submissions.
Even though the forms are gathering slightly different data, at the end of the day, the most important data is the personal contact information (each one collects name, email and/or phone), and each form submission (from any of the forms) is considered a lead by the owner and followed up on.
I would like to centralize these various form submissions (2 webforms + 1 node) into one Content Type (leads) so they could be managed from one page, rather than three, and so the owner doesn't have to reference/compare submissions from two other forms when working with data from one to prevent double-contacting potential clients if they filled out two forms on the site.
Is there an obvious solution for this scenario that could be implemented using some combination of existing modules and Rules. Or, any solution that would at least not stray too far from good Drupal practices?
What about converting the webforms to CCK too, and using a Views Bulk Operations scenario for aggregate/sort/filter capabilities?
I'm not convinced about your desire to consolidate to one content type. You should use one content type only when the forms are similar in structure and purpose. Webform A, Webform B and Case Evaluation seem to be satisfying totally different needs. They are not good candidates for consolidation.
Another alternative is to force people to register (i.e. become logged in users) before they access any webforms and CCK forms. Using the User profile (bundled with Drupal core) module you can collect standard data when people register that you now need to collect anyway for the three forms. It will consolidate your leads data in one place. The registration procedure can be made unobtrusive and simple.
I would also recommend that you use Webforms in general. They are user friendly and are excellent for making questionnaires and contact forms. Use CCK content types for more fundamental aspects of your sites like article content types and where you need views integration.
There is a very useful module called http://drupal.org/project/inline_registration . It allows you to register just before you create a node. I would guess it doesn't work with webform (unfortunately) but please check.
Another option which I feel might might be viable would be to have user fill out 2 forms. One quick webform which captures their basic details and the other webform/node create where they get to do their specific work like request a PDF etc. This way all your lead data gets captured into one webform for which you can get excel file exports.
Before signing off -- another point occurred to me...assume you have 3 webforms (Case Evaluation is turned into a webform). You just make sure that the initial data consists of standard fields like Name, Email address etc. You will get 3 excel sheets (one from each webform). It will be very easy to take the first 3 or 4 columns that you are interested from each sheet for leads data and then combine the data together in one "leads" excel sheet. This quick and dirty method will save you a lot of effort and to my mind will be a "good enough" solution.