PHP Classes

Header with url link

Recommend this page to a friend!

      CSV Handler  >  All threads  >  Header with url link  >  (Un) Subscribe thread alerts  
Subject:Header with url link
Summary:Header url link damages the field entry box.
Messages:3
Author:Jamie Grant
Date:2015-07-13 19:37:55
 

  1. Header with url link   Reply   Report abuse  
Picture of Jamie Grant Jamie Grant - 2015-07-13 19:37:55
I've just came across this excellent csv handler code, which of course can use any field separator.

One of my fields uses HTML Hex colour codes eg Blue=#0000FF

To help identify colour codes I used the below in the header field.
<a href="http://html-color-codes.info/" target="_blank">#colour</a>

In the header the url link #colour is displayed correctly and when selected loads html-colour-codes.info page as expected :)

However the data field format gets corrupted and displays a blank box followed by:
#colour" type="text" id="#colour" value="#colour" size="7">

Any ideas howto use url links in header that dont affect the data fields ?

Another query is howto use validation so that on commit a field is checked against predefined values.

Any help or pointers appreciated.

  2. Re: Header with url link   Reply   Report abuse  
Picture of Jamie Grant Jamie Grant - 2015-07-13 20:39:29 - In reply to message 1 from Jamie Grant
First query solved, just removed the quotes (").
Url Header link changed to below:

<a href=http://html-color-codes.info/ target=_blank>Hex-Colour</a>

Header link working fine and data fields not affected.

  3. Re: Header with url link   Reply   Report abuse  
Picture of Andreas Mueller Andreas Mueller - 2015-07-13 22:39:37 - In reply to message 1 from Jamie Grant
Hi Jamie,

I am happy to hear the CSV Handler is of use to you.
You should be able to use quotes by exaping them, but that would need some fiddling inside the class.

Now validation is a completely different matter and certainly not an easy one:
For the handler to know what to check we need to introduce a reference as to what field can take what value. If we did this inside the csv file the structure wouldn't be compatible anymore.
Of course you might use an extra file (same name as the csv datafile with different extension maybe) to define the necessary parameters and have the handler check for such a file. This would be of limited use though, if validation takes place at commit of a Line.
So we would need to validate on changing a field - either by sending validation parameters and code as JavaScript for the browser to complain if anything is wrong, or by ajax request (like google's autosearch) calling an extra php on the server.
Both methods imply a lot of Javascript, and to my regret that is not my strongest capability :( and would take more time than I can currently afford.

It would be a nice enhancement though and I'll put it on my list of good things to get done on a rainy day.

Regards
Andreas