ClarkePeter’s Weblog

April 2, 2009

W3C is a-okay; the multi-column layout module CSS3

Filed under: Xforms, xhtml — Tags: , , , , , — admin @ 7:45 am

The W3C’s job is setting standards, and as such, they make rules–rules that compliant browsers need to follow. As we know, any person or group that has to make rules often ruffle others’ feathers for a whole myriad of reasons. Rules are rigid–especially with computer standards. People like flexibility and the “old” comfortable way of doing things.

Here is one issue, however, that exemplifies the W3C and their long term goals and how they actually have some meaning in real world application. (more…)

October 21, 2008

Be careful with code copying

Filed under: Uncategorized — admin @ 12:05 am

If you copy any codes from my posts be aware that you’ll have to replace all quotation marks and apostrophes and double dashes in your regular text editor.

January 30, 2008

Xforms Multiple Constraints

Filed under: Uncategorized, Xforms, php, xhtml — clarkepeters @ 4:51 am

Here is an example code for how to do multiple constraints on a form.

(more…)

October 9, 2007

An Xquery article by Kurt Cagle

Filed under: Xforms, php, xhtml — clarkepeters @ 9:50 pm

XQuery, the Server Language

An Xquery article by Kurt Cagle.

A better Legendary Toggle

Filed under: Xforms, php, xhtml — clarkepeters @ 8:51 pm

I put a toggle inside a legend simply because it just popped in my head to try it. This same procedure could work with any type of grouped data without having a legend at all (see Switch/Case Toggle Template or Using Switch Case as a drop down box).
In my post Xforms: The Legendary Toggle
I use two cases with the Switch/Case method to get the effect I wanted–inside the cases are two triggers each with an xforms-toggle–one trigger hides while the other is visible, and vice versa.

However, one doesn’t need a switch/case at all but can rely on “relevance” to get the same effect, without as much coding, and by only using one, instead of two, triggers. Credit for this approach goes to the xforms administrator at xforms.org.
(more…)

Thoughts on xforms php and the DOM

Filed under: Xforms, php, xhtml — clarkepeters @ 8:23 pm

Anyone who has followed my blog knows that I use php to parse my xml data by simply putting my data into an indexed array or an associative array and then manipulating the data as you would any other arrayed data (see http://clarkepeters.wordpress.com/2007/09/02/parsing-without-the-dom-or-simplexml-in-php/. I’m not advocating, however, that this is the best method for dealing with xml–it’s not. The DOM or SimpleXml or other parser’s are designed specifically to handle xml. For anyone who has the time and inclination, learn how to parse with an xml parser. That is especially important when your handling files from sources that are not your own.

One thing you will notice, however, is that as you become more versed in xforms, you’ll find less and less need to rely on the DOM for data manipulation. (more…)

September 19, 2007

Hiding dropovers with CSS and Xforms

Filed under: Xforms, php, xhtml — clarkepeters @ 10:13 pm

A dropover is a drop box that is intended to drop down over any elements that are displayed below it.
For an example see Drop Down over/above lower text (Xforms Switch and CSS). In fact, you’ll need to look over that post to get an idea of what’s going on here (you may want to look at Switch/Case Toggle Template or Using Switch Case as a drop down box). (more…)

September 16, 2007

No files selected (using xf:bind and relevant)

Filed under: Xforms, php, xhtml — clarkepeters @ 8:26 am

I have an xhtml+xforms form in which users are viewing or deleting files from their server. (see earlier posts if you want to know more).
The file names are stored in an xml instance that the xforms is based on. The file names are listed as items in an xf:select1 control (actually in this case, it’s an itemset). When they click a file name, voila! they get to view their file (or delete it).

But what if they forgot to click on a file before clicking the load or submit button? (more…)

September 13, 2007

Drop Down over/above lower text (Xforms Switch and CSS)

Filed under: Xforms, php, xhtml — clarkepeters @ 12:01 pm

Here are some images that show how the Switch/Case Toggle works (see Switch/Case Toggle Template ) . In this particular example, notice how the box drops down above the division below it rather then pushing that division down (which is how it normally operates without any CSS styling). In this case, all I have are two divisions, one division is wrapped around the Switch/Case Toggle and the other division encases the rest of the form. (more…)

September 12, 2007

Switch/Case Toggle Template

Filed under: Xforms, php, xhtml — clarkepeters @ 12:39 pm

Here’s template I keep handy for what I call my switch/case toggle box– I use it especially for tips and notes but it could be used for just about anything. (more…)

Directory list: process delete files

Filed under: Xforms, php, xhtml — clarkepeters @ 10:51 am

Previously we set up our Xforms to send some file names to our php file (see Directory List: Delete files )

Here’s the php to process them. (more…)

September 11, 2007

Using Xforms for Redirecting/Reloading pages

Filed under: Xforms, php, xhtml — clarkepeters @ 8:23 pm

In an earlier post– don’t hit the back arrow! — I was using Xforms to prevent loss of recent data from a browsers back button or browser reload page, in which case the user would be directed to an interim page that had some instructions about navigating the site and also a button where they could get back to the main menu.

I have since decided to skip the interim page and go directly to the main menu. I also did a recent post using an xforms-load control with an xforms-ready event which would send me to a new page while simultaneously reloading the current page ( see Using xf:load with xforms-ready). I’ve combined the two concepts from these articles into a single piece of code that can be used in many reload or redirect settings. (more…)

Directory List: Delete files

Filed under: Xforms, php, xhtml — clarkepeters @ 12:25 pm

We pretty much have everything in place to set up our Delete Files option. But now that we’re sure Mozilla’s itemset is working, we’re going to use a select control with itemset rather than the approach we took in Directory List Xforms and PHP pt. 1 where we listed the files in our directory using xf:input (with a boolean type, which resulted in the same effect as a select element).

Now, however, it should all be much simpler with itemset. (more…)

Directory List and View (with filename only label and full path value)

Filed under: Xforms, php, xhtml — clarkepeters @ 8:44 am

The solution to my last post was quite easy.

Remember I was complaining because the full path of the file was showing in my pulldown menu

But I only want the name without the prefix and suffix. (more…)

Directory List: xforms-value-changed with xforms-load

Filed under: Xforms, php, xhtml — clarkepeters @ 6:50 am

Thanks to Mark Birbeck and his encouragement (see comments in Using xf:load with xforms-ready), I went back and reworked my previous workaround where I used an Xforms page as a redirect page with the xforms-ready event (see Using xf:load with xforms-ready) . The previous post was my first experience with xforms-ready, it was neat and I believe useful (especially if you have a need to go to the server–and I did because I needed to manipulate my file names by adding a prefix and suffix). But this next solution is a bit more practical especially if you have no such need to go to the server.
(more…)

September 9, 2007

Using xf:load with xforms-ready

Filed under: Xforms, php, xhtml — clarkepeters @ 2:17 pm

This is probably not interesting to anyone but me, but I’m obviously having a lot of fun finding out what I can do with xforms. As I’ve mentioned before, there might be better ways to do these things, and I wish I had the time to learn them all. So here’s a new workaround of mine.
(more…)

September 8, 2007

PHP to Xml; get file list

Filed under: Xforms, php, xhtml — clarkepeters @ 1:50 pm

I went back and made the following function more independent. It was originally written quickly to serve a particular program (see Directory List Xforms and PHP pt. 1 ). Now it can be used as a general function. It is in two parts, the first part gets the file names from the directory and puts them in an array. The second part puts the names into an xml structure.
(more…)

September 7, 2007

add “no files selected” to our directory list

Filed under: Xforms, php, xhtml — clarkepeters @ 5:19 am

[[ addendum: 9/8/07 changed $noFormsSelected==”true” to $noFilesSelected==”true”]]

Let’s add one more tidbit to the script which was posted at Directory List Xforms and PHP (pt. 1)

We’re going to add just a few lines that will warn our users that they forgot to select a file
(more…)

September 5, 2007

Xforms: The Legendary Toggle

Filed under: Xforms, php, xhtml — clarkepeters @ 5:59 am

Here’s another cool trick I just came up with. I had a main menu encased in a fieldset with a title in a legend, and I wanted to move the menu to some other pages so people would have a handy main menu on every page. It’s a bit bulky, so knew I needed to hide it, so the switch/case was just what I needed. Then I thought, hey, wouldn’t it be cool if I could just click on the legend and have the menu drop out? Well, here it is folks!

Shut:

….. mmlegend.png

Open:

….. mmlegend2.png

And here’s the code (sorry I don’t have time to tidy it up):

(see also Switch/Case Toggle Template  or Using Switch Case as a drop down box). (more…)

September 4, 2007

Navigating your site with Xforms and PHP

Filed under: Xforms, php, xhtml — clarkepeters @ 2:48 am

There are many approaches to navigating a site. (more…)

September 3, 2007

don’t hit the back arrow!

Filed under: Xforms, php, xhtml — clarkepeters @ 4:36 am

Just like in our previous posts where we were concerned about people hitting the browser’s refresh/reload button and overwriting their data with nothingness, we also need to be concerned about people navigating our application via the browser’s back button rather than the in-app menus we’ve provided them. (more…)

avoiding PHP overwrites pt. 2

Filed under: Xforms, php, xhtml — clarkepeters @ 12:48 am

Earlier I wrote a post called avoiding PHP overwrites

In this example of a case where one might reload a php file that should be recieveing data, I had the PHP file check to see if the HTTP_RAW_POST_DATA was empty or not (more…)

September 2, 2007

Parsing without the DOM or SimpleXML in PHP

Filed under: Xforms, php, xhtml — clarkepeters @ 11:38 pm

You know, I entered this project of mine (the Distance Ed. Forms Maker/ CMS thingy that is not fully formed yet) with a lot of hopes and dreams. I wanted to learn all the “x” technologies and the DOM.

Problem is I’m a real person with a real life and my job isn’t computer programming. So I need to finish this project and just don’t have the time to learn everything. I can do basic stuff with DOM and SimpleXML, but these things can get quirky when your data or data structure gets complicated and you’re not an expert. So I prefer parsing XML myself. How do I do it? I just put them all in an array and manipulate the data as I would any other array. I can do this because it’s MY program and I know the data (so I don’t need generic thingies like parents, children, ancestors, aunts, uncles, and cousins) :) But because I don’t have the time doesn’t mean I can’t do some serious XML manipulation. Why should I miss out on all the fun of this new technology? (more…)

September 1, 2007

Select All from List -Xforms w/PHP (pt.2)

Filed under: Xforms, php, xhtml — clarkepeters @ 12:34 pm

Previously we saw how to make a list. Did you notice the “Apply to all forms” checkbox? This allows someone to check off all files without having to check each and every file individually. But it’s not really a full select option, (more…)

Directory List Xforms and PHP (pt. 1)

Filed under: Xforms, php, xhtml — clarkepeters @ 8:25 am

This was a solution I came up with (based on Kurt Kagle’s survey example from xforms.org) for reading a variable instance element–that is, I never know how many files will be represented in my xforms instance because the number of files created and deleted will constantly change. I wrote this at a time when itemset was not working in Mozilla xforms (maybe it works now, don’t know). (more…)

input/select combo box

Filed under: Xforms, php, xhtml — clarkepeters @ 7:23 am

Dan Mcreary showed me this– somehow I had not known of the selection=”open” attribute and value. Code for combo box: <xf:select1 ref=”my-data” selection=”open”>

+=

(more…)

binding xf:select items to separate instance elements

Filed under: Xforms, php, xhtml — clarkepeters @ 7:04 am

there’s some good code here

http://xforms.org/index.php?topic=73.0

Login/Register frontend

Filed under: Xforms, php, xhtml — clarkepeters @ 7:01 am

Here’s a Login/Register frontend for validating at time of input (validates against incorrect entries but not against passwords in a database).
What is important here is that all this takes places client-side–no scripting, just xforms–instantaneous. (more…)

an Xforms Color Picker — two, in fact

Filed under: Xforms, php, xhtml — clarkepeters @ 6:23 am

This code from a former post of mine at Xforms.org is quite lengthy. My first solution was a bit bulky, so scroll down to my final solution. Kurt Kagle’s example was awesome, but it has java-script, which I was trying to stay away from (nothing wrong with javascript, I just didn’t want any in this project).

here’s the link:

http://xforms.org/index.php?topic=154.0

avoiding PHP overwrites

Filed under: Xforms, php, xhtml — clarkepeters @ 6:15 am

I was losing my instance data at odd times — *poof* — and I couldn’t figure out why.
It finally came to me that sometimes the xforms data gets overwritten when I accidentally refresh a php page.

When I submit my xforms instance from a form, it is recieved as such via PHP:

Code:

+=

if (!isset($HTTP_RAW_POST_DATA))
   $HTTP_RAW_POST_DATA = file_get_contents("php://input");

save2file("stylepage.xml",$HTTP_RAW_POST_DATA);

As you can see I save the data as-is immediately and then the php page will render a message or another xforms or whatever the case may be. (more…)

Using Switch Case as a drop down box

Filed under: Xforms, php, xhtml — clarkepeters @ 6:05 am

Learning by example, my exposure to Switch/Case in xforms was as a tool for navigating a page. The idea being basically that you divide your page into “cases” and then navigate those cases via toggle switches. In this scenario, you are viewing only one section of the page at a time, navigating back and forth between them.

Quite by accident, I discovered that Switch/Case can also be used to toggle a small section opened or closed. With this approach, the page doesnt’ change, only the item that is being toggled opens and closes–sort of like a drop box (and if you enclose this in a html fieldset, that’s exactly what it looks like) (more…)

easy PHP code for data submit

Filed under: Xforms, php, xhtml — clarkepeters @ 5:57 am

Ok, so you’ve played around with Xforms a bit, or are thinking about it. But where does the data go?
Just like any html/xhtml form, setting up the form is not the end of the game. You must submit your data somehow and somewhere. (more…)

Xforms, Controls, and CSS

Filed under: Xforms, php, xhtml — clarkepeters @ 5:53 am

Another of my Xforms.org posts

Here’s a tip for a quick and easy way to layout your controls. You may have noticed that aligning xforms input controls left is a bit ungainly, as the text length of the labels vary which puts the boxes all over the place. (the following tested in Firefox only) (more…)

To submit or not?

Filed under: Xforms, php, xhtml — clarkepeters @ 5:25 am

Another of my posts at Xforms.org:

Here’s a snippet of code to allow users a chance to NOT submit. Again, gotta love all this client-side action without the scripting.
The code renders a submit button that is actually a toggle switch, the real submit element is behind the “Yes.” Answering “No” simply make the “are you sure” question disappear and the fake submit button come back into focus.
The fieldsets and styling aren’t necessary or can be put in an external css file so the code’s not so ugly, but I like the little boxes around the yes and no.
I’m not sure any one really needs a second chance button, but I need it ’cause I don’t wanna get no lip from my students saying, “but it’s a bad test, I really didn’t mean to submit?” :P Yeah, sure, and I suppose your dog chewed up the mouse too!

At any rate, here it is
cheerio

x


Here’s the code: (more…)

Using PHP to keep an instance current

Filed under: Xforms, php, xhtml — clarkepeters @ 5:04 am

I use Firefox and Mozilla Xforms to process all my Xforms applications (versions 2.0.0.6 and 0.8.0.3 at the time of this writing.

Sometimes when I update a form and then have to leave that form and come back the instance is not updated. This could be bad news for my users, as they may accidentally overwrite the old data over their recently input data. (more…)

Xhtml+Xforms

Filed under: Xforms, php, xhtml — clarkepeters @ 4:13 am

Introduction: Clarke Peters — love that name — most especially because it’s not mine. Never liked hearing my own name, although others fancy hearing their names and seeing them in lights or what have you. I’m an English Professpr at a Technical College in Taiwan. Some day in the future. I’ll reveal my true name, but for now I’m sticking with Clarke Peters as my pen name (or should I say blog name).

Why blog? For now, it’s all about Xforms. I’m an old programmer who took a twenty year hiatus from any kind of programming whatsoever and then decided to get back to it again. Only now everything is on the web and the languages are not like any I ever learned–fortran, pascal, basic and dbase. Now everything is X something or another.

So I decided to program — more particularly to build a distance education application. I decided after three months of studying reviewing and testing, that Xml and Xforms was the way to go, that, combined with PHP, (more…)

Powered by WordPress – Hosted by <ixwebhosting.com>