Drupal 7 client side validation on registration form? - forms

I have a pretty complex registration form.. it has about 40 fields (go ahead and laugh, the client wants it that way, argh).
Some of the fields are hidden/shown based on the value of other fields.
The problem with using Drupal built in "required" field is that fields that are not displayed are still tagged as required. Reason being the Drupal validation is done server side.
I need to do client side validation because of the way some fields are hidden/shown.
Is this even possible? If so, how should I go about doing it?

Yes it is possible, there is an #ajax property you can use for this, you are going to have to go quite deep into the form api to achieve this.
http://drupal.org/node/1043838
This not going to be easy, it is one of the most challenging aspects. I think a bit of training would help
I would look at maybe getting a membership for a month to drupalize me or https://buildamodule.com
I have only used Druplaize me as it has more d6 stuff but buildamodule.com is very well priced at $29usd a month. Good luck!

I think this describes the use of the new feature #state in the FAPI. You can read about that here: http://api.drupal.org/api/examples/form_example%21form_example_states.inc/function/form_example_states_form/7

You can have a look at the clientside_validation module, it can handle 'hidden' fields. But normally Drupal validate should respect the #required in combination with #states.

Related

Wicket static markup IDs

In developing an automated test script, our test team is struggling with the fact that Wicket creates it's own IDs that aren't necessarily stable or predictable.
We could go around and invoke setMarkupId manually on each field, but what I'd rather do is build a visitor that does it. But I'm wondering if that's safe in wicket and how I should go about it. Should I setMarkupId(getId())? What about components inside repeaters?
Or is there some handy-dandy setting I don't know about that tells wicket to provide a more dependable id?
Note - we're in wicket 6 if it makes a difference. I know, we should upgrade. We've told our superiors for years. But there's always something more important to do in their opinion, so they haven't let us.
You could use your own IMarkupIdGenerator
Or you could just set the id in the HTML. Wicket won't generate anything if it is already provided
You could use a visitor too
About repeating ids - it is up to you to make sure the ids are unique.

Should I use laravel collective or another component?

I'm starting with Laravel and I've some doubts about the external components.
I've already used the laravel collective and the adamwathan/bootforms and the both show me advantage and disadvantage. I've searched for information or discussion about this and a I didn't find anything
For example, I can build forms extremely fast with these components, but I got limited sometimes.
According with the about session of the laravel Collective they say:
The Laravel Collective is a community organization designed to maintain components that have been removed from the Laravel Framework core
So, if the form is removed from the core, should I continue using this component?
And in the readme from the Bootform, they say
Probably not perfect for your super custom branded ready-for-release apps, but a huge time saver when you are still in the prototyping stage!
What do you think about using external components? Do you think it's a good ideia to use or do you prefer the original core from the Laravel?
After 3 weeks working with Laravel. I've learned somethings:
If you want to build easy forms without html, I recommend you to use the AdamWathan bootform or Laravel collective. The only problem is: These tools doesn't has a good option with you want a very customizable field.
Bootform
Pros
Bootform has more components and functions
Reduced Boilerplate
Automatic Validation State
Some custom forms, like the horizontal forms
Cons
Some difficulties with documentation
Laravel Collective
Pros
All necessary things to build a laravel form, like the CSRF Protection and hidden fields.
What I do
Actually, I'm working with Collective and html. I use a mix of the both, when I need a simple field or specific fields (csrf protection, for example) I use collective and if I need a more customizable field, like a button with an icon or a special element in bootstrap, I use just HTML.
Recently I've had the same dilemma, so I decided to examine Laravel Collective Html package.
I wanted to share my thoughts, therefore I created the following post: Is it beneficial to add Laravel Collective Html into your Laravel Project
Hope you will find it useful.
It comes down to personal preference, Laravel Collectives gives you ease of pre selecting select inputs, csrf out of the box, etc... I found myself using it less and less and then eventually just stopped pulling it in altogether.

Orchard CMS right for this? And how to proceed?

Elo!
The goal is to build a Webshop where all the product categories and products (aswell as user authentication, order placement, order history, etc etc) comes from a REST webservice..
So basically very little data will be stored in the CMS DB..
I've managed to extend the login-part (looking at "Windows Authentication Module"), but im not sure how to proceed with the other parts?
Is the answer here a way to go? However the answer seems to claim that we would need records for each product?
How to change Orchard record repository
First of all, this is something you might want to consider. Do you really want to flood the rest service with requests. From the way you put this question (very little data will be stored) it seems like every time someone browses a page, you create a REST request. This usually is not a good idea, so be sure to include some caching.
Then, I doubt it's windows authentication you want for a webshop. Make sure to check out forms authentication.
Then, I guess orchard is something you could consider for this project. Regular webshops usually have so much overhead that it is better to create a webshop (with this specific requiremetn) in a regular CMS, and orchard is very extendable.
One mayor thing is, payment. Make sure you have a good payment processor that works (or that you can make it work) for orchard.

Method to allow email recipients to change their account information

I'm using SugarCRM Community Edition. I have a bunch of contact information. There are fields I have empty that would like filled. I want each user to be able to fill out a form and fill in those fields.
I'm not sure how to hook each contact into the database. I imagine creating a generic form that somehow hooks into the database using a key. The form/php is not the issue. What is the 'key' and where is the 'door'? I think the door is the SOAP API but I'm not sure. The key, maybe the tracker id?
The only thing I am familiar with as far as interaction between an email campaign and the contact is the campaign 'Tracker'. I know the tracker url with removeme is used for allowing the user to opt out of emails. Is there a way to use this tracker to allow the person to edit their information? I think the answer to this is easy but I need some guidance.
One way of doing this is using the built-in REST api. There are a couple of helpful tutorials out there, here is a link to the one I used for guidance in a similar situation.
You can have a form post the data to your sugar crm's REST gateway, accessible via the url http://localhost/sugar/v2/rest.php.
Although it is quite straightforward to implement, you may want to look at this wrapper class that can be used to maybe keep things cleaner than the hacked up script churned out on the spur of the moment I used in my project.
Last but not least, be sure to glance over the documentation, in the Web Services section you will find more information.
Good-luck

Jira RPC/SOAP GetCustomFields() can only be used by an administrator?

I'm currently using the Jira SOAP interface within a C# (I suppose the language used here isn't terribly important).
Basically, I'm creating an API and a Winform that wraps some of the functionality of the soap service so that our Devs can programmaticly add bugs when something goes wrong in our application.
As part of this, I need to know the custom field IDs that are in use in Jira, rather than hardcoding them (as they are still prone to the occasional change) I used the GetCustomFields() method in the jira-rpc api then filtered it, so that all the developer needs to know is the name of the field, then the ID is filled in for them automagically.
This all works fine, but with one quite important proviso: that you login to the SOAP/RPC service as a user with administrative privaliges.
The Jira documentation indicates that the soap/rpc service follows the usual workflows and security schemes, however I can't find anything anywhere that would appear to remove this restriction on enumerating custom fields (and quite why in any instance you would want someone to HAVE to be an administrator to gain this access, especially as the custom field id's tend to be in Jira's HTML source is beyond me)
Does anyone know if I've missed a setting somewhere? Or if there is some sort of work-around for this, short of hardcoding the custom field id's?
Or is this a case of having to delve in to Jira's RPC plugin and modifying the source for it in order to give me the functionality I require?
Cheers
Edit for the sake of google/posterity
Wow, all this time on, and it looks like Atlassian still haven't changed this behavior.
Worked around this by creating a custom dictionary that logs in as an administrative user, grabs the custom fields and then logs out. Not ideal, but it should work 'til atlassian change things
You're not missing anything - there's no way to get custom fields via standard SOAP API.
In JIRA Client, we learn about custom fields in two ways:
We download issues via RSS view of the issue navigator, or via XML representation of a specific issue. If a custom field is set for an issue, the XML will have its id, class and value (values).
From time to time we inspect the content of IssueNavigator search page - looking for searchers for the custom fields. Screen-scraping the HTML gives us not only ids of the custom fields but also possible values for enum fields.
This is hackery, of course, and it may go wrong, so a good API would have been a lot better.
In your case, I can suggest two solutions:
Create your own SOAP (or REST) remote API plugin that will give you just that info that you miss from the standard API. Since you're seemingly in control of your JIRA, you can install anything there.
Screen-scrape the "New Bug" page for the project and type of issue you need to submit. You'll get all the info - fields, options, default values, which field is required.