Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

How to highlight incorrectly filled form part?

Quote Reply
How to highlight incorrectly filled form part?
How is possible to highlight incorrectly filled form part?
I would like to highlish the incorrectly filled form part, like the name or category, so on the error page, the table of forms name and category will have red background...
Is there an easy way to to this? Unfortunately, as I know this is currently not possible.

The GT::SQL::Table::add($p) call gaves back the ID if is correctly added, otherwise, undef.

Does anybody know a solution in LSQL?

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] How to highlight incorrectly filled form part? In reply to
Only realistic way I can think of is to get each and every possible error and then do tags in the templates like

<script>

<%if Error = "Your username is already taken%>

document.forms.signupform.Username.focus;

alert("Your Username is already taken");

<%endif>

</script>
Quote Reply
Re: [webmaster33] How to highlight incorrectly filled form part? In reply to
You can find the error in GT::SQL::error.

Here's a snippet of code from one of the plugins:

====
if (! $new_table->create()) {
$GT::SQL::errcode ||= ''; #silence -w, ugh.
$GT::SQL::errcode eq 'TBLEXISTS' ? ($message = "Could not create table <B>$table_name</B> (table already exists)\n") :
($error = "Could not create table <B>$table_name</B>: $GT::SQL::error)");
$new_table->set_defaults();
$new_table->save_schema();
};
=====

I'm not sure what errors are trapped, but you do get more information than just "undef" :)


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] How to highlight incorrectly filled form part? In reply to
Thanks your help & info.
In the meantime I was able to discover how the error checking, reporting, and form validating works. It is done in a strange way through package globals, and the error() method.
I would do it in an easier way in place of Alex (however it is working well).

This "highlight the form fields with error" feature is being implemented into my Xtended A.M.D. plugin (XAMD) which enhances the current features (LSQL 2.1.1) of link adding, modifying, deleting.

I solved the problem in the following way:
- duplicated the affected functions (methods)
- changed to pass back hash content containing like Contact_name_error => "error message"
- I solved it by keeping original functionality if this feature is not enabled

pugdog: the add method in GT::SQL::Table gives back id, if add was successful otherwise undef. The real error reporting is done through the error method of GT::Base.


New features already added to Xtended A.M.D. plugin (XAMD):
- Form input fields are generated automatically and are available through tags like: <%Contact_Name%>, or <%Password%>, etc... - implemented for add
- Fully changeable display format of individual error messages, through template: error_form_sub.html. The error messages are inserted through error_message tag - implemented for add
- Changeable individual error message delimiter. Default is "<br>". - implemented for add
- Fully changeable display format of the error table, through template: error_form.html. The error messages are inserted through error_list tag (originally I used the error_table tag, but I decided error_list tag is more descriptive. Please tell me, if you like error_table tag much better). - implemented for add
- Error messages are displayable separately through template tags: <%Contact_Name_error%> or
<%Password_error%>, etc... - almost finished for add, already working
This way you can highlight the input fields where has not correct input this way:
<%if Password%><table border=5 bgcolor="red"><tr><td><%Password%></td></tr></table>
<%else%><%Password%><%endif%>


Opinions, comments are always welcome.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Aug 6, 2002, 3:00 AM
Quote Reply
Re: [webmaster33] How to highlight incorrectly filled form part? In reply to
Quote:
In the meantime I was able to discover how the error checking, reporting, and form validating works. It is done in a strange way through package globals, and the error() method. I would do it in an easier way in place of Alex (however it is working well).

It's not strange at all, infact it is a very good way of doing it. The error method is inherited from GT::Base allowing all packages to call the error method. This allows for centralized code which is clean and reliable.

Regarding your plugin, I hope you have lots of time for support because I can see this being a support intensive plugin.
Quote Reply
Re: [Paul] How to highlight incorrectly filled form part? In reply to
Yes, maybe you are right, it may be a support intensive plugin.

However, I will only release the plugin if all things are automatized, and it can be easily installed and used. I also plan to implement many options, so the user can turn off any individual feature.
So if it has a lot options and I provide a good documentation, the support need would be not more than another plugin.
I plan to give 6 month e-mail support, when the plugin is purchased.

It is likely, that my plugins are more complex than other's, because I have to replace & modify many basic functions. Therefore, if new LinksSQL versions are released, I may have a lot work to do the upgrades for the plugin.
This will make the development a bit difficult for me, I still thinking on a solution.
Probably I will give 1 year free upgrade or free upgrade for minor versions.
I don't know yet, which one is better.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] How to highlight incorrectly filled form part? In reply to
>>
It is likely, that my plugins are more complex than other's, because I have to replace & modify many basic functions. Therefore, if new LinksSQL versions are released, I may have a lot work to do the upgrades for the plugin.
<<

That defeats the purpose of a plugin. Overwriting core code is a bad idea for the people using the plugin and the person making the plugin. What happens if people with to uninstall the plugin. Will they be left with overwritten modules that they can't reverse?

What if your plugin has some bugs that cause errors, people won't know whether it is a links sql bug or a bug with your plugin, GT may start getting support email for bugs that aren't to do with them....I'm sure they'll appreciate that Crazy

A plugin should _add_ to what is already there. If you have to modify core code then either you need to re-think your plugin or you are duplicating features as such. The most obvious example is the thing you mentioned above about the add/modify forms....errors are already displayed in a neat and clear fashion, why would you then make a plugin to restructure the form pages so all the tag names are different?....it sounds like a wheel re-invention Smile

Last edited by:

Paul: Aug 6, 2002, 3:57 AM
Quote Reply
Re: [Paul] How to highlight incorrectly filled form part? In reply to
You are very sarcastic, and seems you make fun of me... Not a fair thing.

Quote:
That defeats the purpose of a plugin. Overwriting core code is a bad idea for the people using the plugin and the person making the plugin. What happens if people with to uninstall the plugin. Will they be left with overwritten modules that they can't reverse?
You completely misunderstood my explanation.
The function replace means, the original code is untouched, the new features are added by plugin functions, which was duplicated from core code.
Please do not guess what my users will think about the plugin (or at least not so sarcastic way), the users will decide themself...

About "wheel re-invention"? I did not tell you that it is any kind of invention, but it is a new feature to Links SQL. This kind of error highlighting is used on several websites, except on LinksSQL powered websites. That's why I think this feature has place in LinksSQL, so I place in my plugin.

EDIT: By the way: I develop the plugins for primarily myself. The new features are implemented because I need them. The reason that I plan to release the plugins is, that I think others may also find these features useful. Any why do I plan to sell the plugins? Because I have a lot work in them.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Aug 6, 2002, 5:13 AM
Quote Reply
Re: [webmaster33] How to highlight incorrectly filled form part? In reply to
Quote:
You are very sarcastic, and seems you make fun of me... Not a fair thing.

I assure you nothing I said above was sarcastic. I think most if not all the points I made were valid.

Quote:

The function replace means, the original code is untouched, the new features are added by plugin functions, which was duplicated from core code.

So how are you getting your plugin code to run?...I'm not sure everything you've described can be done solely with hooks?

Quote:
Please do not guess what my users will think about the plugin, the users will decide themself (or at least not so sarcastic way)...

Where did I decide your users thoughts?...I gave my own opinion of what I thought and IMO provided some pretty important things for you to consider (based on how I interpretted your plugin to work from your desciption, whether I understood correctly or not).
Quote Reply
Re: [Paul] How to highlight incorrectly filled form part? In reply to
Quote:
I gave my own opinion of what I thought and IMO provided some pretty important things for you to consider
If you told that in IMO context that's ok.
However, the mentioned feature I implemented is a known feature on the internet.
Your sentence "it sounds like a wheel re-invention..." was not a fair opinion declaring, and was a bit strong. Shocked

Quote:
So how are you getting your plugin code to run?...I'm not sure everything you've described can be done solely with hooks?
Very easy Cool.
You just hook, right the first hook displatched in the cgi. This is the usually the handle_* plugin. From this part you can execute any code, even use your own or any code you want (you can even just display a page with text "Hello World"). Wink

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] How to highlight incorrectly filled form part? In reply to
Quote:
You just hook, right the first hook displatched in the cgi. This is the usually the handle_* plugin. From this part you can execute any code, even use your own or any code you want (you can even just display a page with text "Hello World").

That sounds like you are overriding big chunks of code, regarding the handle_ hooks. You just need to make sure you know what you are doing as many things are going on internally and if you override lots of code it is possible that your plugin won't take care of these issues so just be aware of that. (I'm not knocking your programming, just saying it is something to be aware of).

Last edited by:

Paul: Aug 6, 2002, 5:56 AM
Quote Reply
Re: [Paul] How to highlight incorrectly filled form part? In reply to
Quote:
That sounds like you are overriding big chunks of code, regarding the handle_ hooks.
Not so big chunks of code are required to override. But if PRE or POST hooks are not enough, then there is no other way to implement a new feature, without touching the original core code.

Quote:
You just need to make sure you know what you are doing as many things are going on internally
Yeah, very true.
That's why I have to discover LSQL code deeply, and why my developments are going slower.
The LSQL and GT module documentations are poor sometimes and there are many hidden features which are used, and I have to reveal what these codes are doing. Not too easy, I can tell you.
I asked the Alex and the GT dev team many times, and got great helps, however not all times. There are still missing documentations, like for the GT::SQL::Display::HTML, and ::Related and ::Table. Also usage of html() method is very poorly documented.

Quote:
if you override lots of code it is possible that your plugin won't take care of these issues so just be aware of that.
Yeah, I'm aware of that.
My plugins will be thoroughly tested by me on my live website before the public release.
I think (and hope), that my plugins will not have more plugins, than other released LSQL plugins. And if will, the bugs will be corrected.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] How to highlight incorrectly filled form part? In reply to
>> You are very sarcastic, and seems you make fun of me... Not a fair thing.

I don't think this was intended at all. Paul presents a real issue. The point of the plugin is to *not* have to do that. You are able to use all the built in Links functions, and only add/modify the parts you need to. You don't have to rewrite or maintain the parts that GT/alex/etc is doing.

If you do duplicate the functionality, you have to rewrite the code each time, which is what the plugin system was set up to avoid.

The plugin system was a response to all the requests for a way to make changes and modifications survive upgrades.

The way you describe your system, is essentially taking the "old" way, of directly modifying the codes, and stuffing it into a plugin -- sort of a hybrid :) It's a lot of work, and down the road it will most likely lock you into a specific version.

If you "hook" into links, and only alter the parts that need altering, leaving the base codes and functionality intact (doing the pre/post hook dance), you have a much better chance of surviving upgrades.

On the other hand, if you rewrite the functions completely, you need to be aware that if links changes, you'll have to rewrite the function again, instead of just minor updating, or maybe not having to make any changes at all -- something most of us have tried to avoid more than writing templates ;)


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] How to highlight incorrectly filled form part? In reply to
Pugdog,

You and Paul were criticize me, because of the code replacings. I would be glad if you were telling your opinion about the features, not about my programming technique.
You are criticizing, but you are not offering alternate solution... I don't know either, so I'm continuing my development on the best known way.
(Paul criticized my error highlight feature, by telling it is re-inventing of the wheel. I think this is not constructive criticism.)

So I'm doing best of my knowledge developing my plugins.
- I'm still using the plugin system without modifying the core code, did I mention it? Wink
- Do you know, that the plugin system makes possible replacement of several hooks, functions? Wink
- Did you read, that I'm aware of the problem of upgrades?
- Did you read, that I write the plugin primarily for my needs? So it mean I have to do it.
- Did I mention, that the hook docs are not enough detailed sometimes?
- Did I mention, that using the PRE and POST hooks the possibilities of altering current features are very limited?

You will be not able to alter current features and extending with real new features, without replacing hooks and maybe some of the functions... Angelic
It happens, that there are hard coded things in GT modules... Like the "---" for the select downdrop forms, there are no default value selected. "---" is not enough for me, so I replace with a changeable text (even changeable individually for each select downdrop list)
What do you do in those cases?

Again I do my best, when I develop the plugins and try to solve problems without replacing core codes.
In several cases I do not afraid about my codes, because some of they are more flexible it is in LSQL, and I'm not afraid that LSQL will overgrow in customization of these features.
I quickly remember 2 examples, but there are more:
- the altavista span page can be assembled like a LEGO, almost any part of it is customizable Cool
- my enhanced (and replaced) title_linked function is more customizable, than it could be in LSQL, while it is still backward compatible with the old function calls. Cool

EDIT: So in several functions, evolutional change of replaced LSQL functions will be not very big problem (at least I hope Angelic).

Ok. So rather than discussing about my programming techniques, I would be glad to discuss about the features if there are opinions.

Paul says separating error messages to individual tags is unnecessary, the original is better. Having separating error messages there is possible to display red background to those fields, which was not filled by the user as we wanted.
(BTW: the original error display way can be still used as usual, the new features are additionally available to the original ones. Wink And new features can be anytime disabled on admin interface. Wink).

Other opinions?

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Aug 6, 2002, 9:19 AM
Quote Reply
Re: [webmaster33] How to highlight incorrectly filled form part? In reply to
Hi,

You are missing the point we are trying to make. Neither of us is attacking you, or criticizing you, but we are trying to point out that there are features in Links that should be exploited -- such as NOT rewriting the routines.

Our observations are essentially that you are "doing it the hard way", and using methods we "fought" to get changed so we wouldn't have to keep doing it the hard way! We are trying to *SAVE* you time and effort, and frustration in the long run.

You ask for help, and assistance, but the first help and assistance Paul and I gave you is to try to make you understand that the style or thinking you are using is *probably* not the best way to go about solving these problems.

The point both of us are trying to make is that if you take the time to think about how to use the plugin/hook system, and to write your code around those hooks, you'll find you have more time now and in the long run to devote to adding in features, rather than maintaining and rewriting things. You'll also get less bugs, since there are about 200+ different flavors of Links out there, all with minor bug fixes, some that have been applied, some that haven't, etc.

Also, you will find that the major plugin developers here are *not* rewriting links code. Because of that you will not be able to get as much help rewriting or maintaining the code, as you can get in hooking into it, and altering it's behaviour.

Most of the programmers here do not think in terms of Links base code, but rather in terms of globals, functions, and hooks.

These are earnest suggestions in your long term best interest, not a criticism. I haven't seen your programming or coding to criticise you on it! It's a way of thinking -- like OOP vs non-OOP. OOP has significant advantages, but there are those who say it's overkill, and unecessary. Many of us have reached the decision to upgrade our way of thinking in order to reclaim what little life a programmer can have! Take the suggestions in the spirit in which they are given -- but on the flip side -- understand that if you don't get the kind of help and support for your project you think you should be getting it's not personal -- it is probably because your way of thinkng is not the same way of thinking going on in the rest of the forum.

And, if you have rewritten replacements for hard-coded items in the modules, post them here for comment, and maybe Alex can incorporate them into the next release or bug fix as an enhancement. Most of the globals, settings, and such were done this way. People wanted/needed them, Alex saw the point, and did it. It makes the plugin system that much better when this sort of code is shared.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] How to highlight incorrectly filled form part? In reply to
Quote:
It makes the plugin system that much better when this sort of code is shared.


Good point.

I would like to see some of the more commonly used plugin functions incorporated into the base code again (like some of the install functions).

Being a very new perl and links programmer, I personally found the easiest way to write and maintain plugins was to use a much of the existing code as possible. Someone has already done a lot of hard work... I just put their functions together (together with my own) to make a nice plugin.

I see a point of webmasters in that perhaps the plugin system could use a little "upgrade" of sorts to make some things more easily acheivable without having to modify core code.

Just a though, I will get out of this thread now.Smile


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [webmaster33] How to highlight incorrectly filled form part? In reply to
Hi webmaster33,

Can you post the URL of your website? Then we can see how the error checking and other features work.

Thanks.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [pugdog] How to highlight incorrectly filled form part? In reply to
Quote:
Our observations are essentially that you are "doing it the hard way", and using methods we "fought" to get changed so we wouldn't have to keep doing it the hard way! We are trying to *SAVE* you time and effort, and frustration in the long run.
Thank you very much for your support and helpfulness!


Quote:
You ask for help, and assistance, but the first help and assistance Paul and I gave you is to try to make you understand that the style or thinking you are using is *probably* not the best way to go about solving these problems.
I ask first, if anybody knows about an implemented solution for the problem. I got some idea from some people here, but basically I had to discover myself the hidden features, then develop my planned feature with *MINIMUM MODIFICATIONS* on duplicated code, while I try to keep the new code *COMPATIBLE* with the old one, and I improve the functionality.


Quote:
Most of the programmers here do not think in terms of Links base code, but rather in terms of globals, functions, and hooks.
I also use globals, functions, and hooks... Oh yeah, and I do have to replace some core code parts because there is no other solution.


Quote:
It's a way of thinking -- like OOP vs non-OOP. OOP has significant advantages, but there are those who say it's overkill, and unecessary.
That's interesing thing and I think you are right. I don't know OOP very well, and I'm still starting to get familiar with OOP.
It is very possible, that my solutions could be written more OOP friendly, so I would not need to duplicate core codes. In that case, when I will be more familiar with OOP, then I will rewrite those parts of my plugin. I'm always learning from my errors, faults, bugs, as all programmers do... So then I will release a bugfix release. But until that time, I do give my best knowledge to finish my plugins and make them bug free and user friendly. No matter what programming technique I used.


Quote:
And, if you have rewritten replacements for hard-coded items in the modules, post them here for comment, and maybe Alex can incorporate them into the next release or bug fix as an enhancement.
The idea is good, but:
1) Most of these modifications are done to fit needs of my plugins, so they are not always the same what others would need.
2) If most of my main modifications are done in a basic function like "build_category", and I make it available for the public for free, then why I worked so much?
3) But there are some, which would be useful to released for the public. The release interval of LSQL is so rare, that I can not wait so much until the awaited feature will be appear in next release.
4) I contacted Alex through e-mail, but I still did not get answer for the cooperation offer, that we should cooperate together in improving the config system, the plugin system, and I offered that I would post my changes to the CVS of the LSQL or send the improved modules to GT to include to the core code of they like the changes. I never got answer to my offer...

I forgot to mention earlier, that I redesigned the URL treatment. It is a half finished development, which right now includes just the basic features for my needs. However if I do decide to finish it, I would be glad to allow including it in the core code of LSQL.
You can find our discussion with Alex about the change of URL generation here:
- URL generating thread (in the meanwhile I developed almost all features I asked, from 2. to 5. feature, except the 1st one, since it would need cooperation between Alex and me, but until not there is no cooperation...)

Pugdog, you are talking in general about LSQL developments but you did not suggested any alternate solution to core code duplication solution. Do you know alternate solution?
How would you do, to have all the error messages available separately like: "Telephone_error" or "Category_error" ?
EDIT: I mean available on add, modify pages


If you tell me alternate solution compared to my solution, then I will accept your point, not to duplicate core code.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Aug 7, 2002, 7:17 AM
Quote Reply
Re: [yogi] How to highlight incorrectly filled form part? In reply to
Yogi,

My working website currently still runs under my very modified old Links 2.0. Until I do not finish developing of my plugins I will not upgrade my website to LinksSQL, since I do not want to "degrade" it to basic features of LinksSQL, since I run a Classified Personal Ad service (it does not mean that LSQL is not a great software, just it doesn't fit my needs in default state).

BTW, my website is non-english so you will not understand too much from it. Wink
If you still want to look at it, I can send the URL in private message (as I sent to Paul earlier), but I would not like to publish on the forum, since it nobody will understand it.

About my current LSQL installation: it is placed on my local machine, and I develop the plugins using local webserver. My ISP doesn't allow server access to local machines. So I can not give you access to the development site.
The only solution, if I do screenshots.
I will publicate screenshots as I will have a bit time to create *normal* screenshots for the public, using the original templates and using English language, not my national language.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...