Javascript not working on Blackberry - php

Have a script that using jquery validation. Tested on 2 Blackberry's and neither worked properly.
http://andrewpeller.com/contest/indexTest.html
1st one - Blackberry Bold
Email validation would not work even with valid email such as test#hotmail.com
2nd one
Form would not submit at all.
Any suggestions as to how to get this to work? Will jquery even work on the blackberry?
thanks

You will probably need to accommodate users with JavaScript turned off when aiming at mobile devices.
Your form seems to be designed so that it can't be submitted without Javascript turned on. You would have to change this to make it work on non-JS browsers. Make sure you have some kind of server side validation for the fields.

The default Blackberry browser is very limited in JavaScript. I would not expect jQuery to work well in its default browser.
However, I suggest to try using Opera Mini for the Blackberry. It handles JavaScript much better. I managed to run a few web applications using ExtJS 2.x (jQuery adapter) in Opera Mini on various Blackberry models, without problems.
If you are going to deploy this web page to the public, I suggest using plain XHTML/CSS and do server-side form validation.

I don't know what BlackBerry you have but besides Opera Mini you should also look at the new Bolt Browser it is really nice.
Now with that being said. As a mobile developer for many, many years I always encourage developers and clients to develop their mobile sites without the requirement for JS, whenever possible.

Double check your BlackBerry browser options - some devices have Javascript turned off by default.

Bolt browser is not supported now. Actually jQuery validation works on bb5 but breaks onfocus, onblur events. On bb6 it works fine.

Related

Unknown Technologies for Web Forms

I am trying to get to grips with various forms of web design and build. I have looked around and still cannot get a useful answer on what technology is best to create a Dynamic Submission form (that doesn't look like crap).
I want to build a sumitable form that is aesthetically pleasing. I have planned and sorted out that I will use PHP and AJAX so it can be interactive but I am lost on what technology to use to actually code/script the design of the form. If anyone can help it would be greatly appreciated, thanks in advance!
If anyone who reads this uses Virgin Media as their internet provider and they use their card details form online, that is my ultimate goal to make the form similar too (with different questions and submission details, but that isn't important). The look is what I am after.
you are on the right track actually.
for aesthetics, you should research more about designing in HTML/CSS
JS is used for the dynamic user interface
PHP and AJAX are all that's needed for a dynamic form submission
google is your friend. go ask him.
other than that, it's up to your imagination and originality how you implement it.
you would need to use html and css to actually build the form.
Javascript to possibly validate the form on the persons browser (client side)
php would submit and send the form.
If you like the look of the virgin media form you can find out how it was done by using developer tools on chrome (f12 on a windows machine, cmd, alt and I on a mac) or firebug pluign on firefox. Others are available but these are two of the best. This wll show you the html mark up the css and how it all works.
Here you have some examples of interactive forms: http://www.catswhocode.com/blog/10-jquery-tutorials-for-working-with-html-forms
Your best bet will be with ASP.NET.
Its easy to set up and the software is easy to use and is free.
You should use Microsoft web developer express.
http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-web-developer-express
You will have the choice to code in c# or visual basic , c# will be the beter choice.
ASP.net is the new generation of website development.

How to send webkit user agents to one site version and all the rest to another?

I am a humble graphic designer who is trying his best to learn development. I have a challenging question that I need some very clear and straightforward help with. From my research it seems that my solution can be accomplished with PHP or Javascript. I am totally an infant in both languages but I don't care which one is used. Preferably whatever is easiest for a noob like me.
So her is the deal…
I have a site I have just put together with a bunch of nice -webkit-transforms http://www.eameswords.com I want to send desktop Safari/Chrome to this site. I want to send iPad and iPhone to a separate touch enabled version too.
The kicker…
I have an Adobe flash version of the site as well. It does all the same interactivity. I want to send user agents for IE, Firefox and Opera to this version.
So I have 3 versions of my site!!
I would like to put all three versions of my site in three separate folders for organizational purposes.
So I need three types of user agent detection and three redirects:
iPad & iPhone (mobile Safari) ––––> folder01
Webkit Browsers (Safari/Chrome) ———> folder02
All other browsers (IE, Firefox, etc.) ————> folder03
This is crazy but I need some serious help to make this work. If anyone can give me a straightforward answer I would be happy to swap any of my design skills to pay-it-back. I say this because I need someone to literally write out the solution so I can process it, learn from it. I am really bad at piecing code together.
Thank you so much in advance!!!
Check the user-agent header for the signature.
For example, in PHP:
$user_agent = $_SERVER["HTTP_USER_AGENT"];
//Condition checks: Does $user_agent equal the signature of a webkit browser?
//If not, redirect: header("Location: main.php?nonwebkit=true");
Search for the existence of "webkit" in the User agent string. If it exists, fine. Otherwise, redirect the user to the flash page.
jquery solution:
$(document).ready(function() {
if(navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i)){
window.location.replace("URL1");
}
else if ($.browser.webkit){
window.location.replace("URL2");
}
else{
window.location.replace("URL3");
}
});

What is the easiest way to convert existing PHP web application to mobile application?

Suppose I have developed one web portal in PHP/MySQL. I want to make it work in mobile also. What is the easiest way to do this?
Can we use PHP with any mobile based mark up languages like WML or XHTML i.e. as we can use PHP with HTML in web applications used to view in normal web browsers?
PHP has nothing to do directly with the platform you want to display your app on. PHP is just the tool to deliver the kind of markup you need for your page to be displayed on whatever platform you want. It's up to your own knowledge and creativity to render markup which suits your needs. So in other words, yes of course you can send WML, XML, XHTML, you name it to the client!
The client doesn't know anything about PHP anyways (PHP 'exists' only on the server side), the client doesn't understand PHP and doesn't need to. It understands XHTML or any other markup and that's what you have to deliver! What tool you use to do that is completely up to you. PHP is one option.
So all you need to know is for what platform/client you want to render your content and what kind of markup this platform understands and then deliver the right markup to the right platform/client including the respective CSS, js, etc.
What your app does:
detect what client is requesting your site
see if you're able to send the appropriate markup
send this markup or if not available some default or similar markup
Pseudo-code for each page, (or just the template page, if you have that)
<?php if(mobile()): ?>
Mobile HTML and PHP
<?php else: ?>
Desktop HTML and PHP
<?php endif; ?>
I use this.
Depends on what you understand under the term "mobile". Basically it would just mean to adapt your portal displayed data and css to the smaller display sizes and make as ZOMFG said an if statement to output your source accordingly. If you want to enable WAP browsing you have to output your data in the Wireless markup language.
PHP is just a tool which generates some markup language (or anything else, actually, which might not be markup-oriented at all) that is understood by the client -- the browser.
Your PHP code will have to be able to generate two kind of different outputs :
a "full ouput" (likely HTML), which you already have, for computer web browsers
a "light ouput" (maye VML, maybe HTML too but without some heavy stuff), for mobile-based browsers.
The task you'll have to deal with is to differenciate between mobile and non-mobile users ; this might be done by user-agent sniffing, for instance, or detecting what the client requested.
A nice thing to do could be to use a special domain-name for users of mobile platforms ; something like mobile.example.com ; for instance, so they can bookmark it and directly access the "mobile-version" of your site -- can be useful if your detection doesn't work well ^^
If you are targetting advanced-mobile-machines (like iPhone) which have a not too bad browser, you might want to send them "rich" HTML pages ; just test your pages to verify they fit on the small screen of theses machines ; and, maybe you'll want to send less data (like not display some sidebars, or have a smaller menu, ... )
BTW, what kind of platform do you mean by "mobile" ? Those old phones with small screens, or more power-users-oriented phones, like iPhone / Android / stuff like that ?
This could make quite a difference, actually, as the more recent ones have nice functionnalities that the oldest didn't have ^^
In any case, one important thing to remember :
you will spend some time making the site work on these devices
you will have to spend more time maintaining it !
Which means : do something simple, and, as much as possible, use the same PHP code for both mobile and non-mobile version of the site : the less code you duplicate, the less code you'll have to maintain !
Hope these few ideas (not really well sorted, I admit) will help...
Have fun !
Already the mobile browsers support almost full XTHML, Javascript, Flash.
My recommandations are:
have a light css for the mobile
version
restrict some heavy functionalities
validate your code
optimize, optimize, optimize, although this works even for the full version.

Validating html generated by php

I'm new at web development, so to make sure I'm writing good code I've been using w3.org validation tools. I'm currently working on a project where I generate a lot of my html with php functions, and I'd like to validate the html, but w3.org doesn't support that. The only way I've found to do it is to render my code, view source and validate that, but that's an awkward, time consuming process, that only approximates validation as it renders differently in different situations. Any suggestions?
Thanks,
Rebecca
Tidy Project:
http://tidy.sourceforge.net/
http://www.w3.org/People/Raggett/tidy/
Good luck.
Edit -
To be clear, with Tidy you can be reasonably certain that the output of your script is valid against a given standard.
You can use Html Validator add-on for FireFox.
The various developer tools in the major browsers will help you validate the HTML your script emits.
IE6/7 - you can install the IE Developer's Toolbar
IE8 has the toolbar built in
FireFox - you can get the Web Developer Toolbar as an addin
I think Opera has some tools built in as well, but quite frankly I only use Opera for testing after I've built using Fx and IE.
The validator tools will not care about php, so if your php is 'bad', it won't care.
It only checks html for concision and proper nesting to the doctype.
Try this, Web Developer 1.1.8 toolbar.
This ad-don works superbly, you can validate locally, for example:
Validate Local CSS
Validate Local HTLM
if you don't have access to some external web-server or even if you do have access to it.
In addition the installation is easy and to validate a given page all you have to do is right click on Tools and there is a whole array of validation options.
https://addons.mozilla.org/en-US/firefox/addon/60
Alternative approach: Hitchhike direct-input at the W3C validator:
( I am also facing the problem, that my staging server would need to be online,
to allow for an easy validate-here link... )
The direct input at the w3c validator submits a form.
Or in other words: The actual validation-page receives a POST request.
So how about: Make a link (i.e. in your footer) that leads to a submitForValidation.php
In that php file:
grab the Referer-URL you just came from (through your localhost server)
submit as POST to the W3C page
Not done it yet, but will probably implement that soon.
Step 1: Run the PHP to generate some HTML, with a command like this:
php index.php > index.html
Make sure that php is in your system PATH variable.
Step 2: Validate this index.html with normal html validation tools.
Opera 12 is good for validating generated pages, you just go to the page, then right click and validate. that's all, so easy that scares lol.

Why is the Internet Explorer Autocomplete feature disabled for all html forms on my website?

When Internet Explorers AutoComplete is turned on for Forms the entries for each field in the HTML form should be cached and displayed as a prompt when the user starts entering content into the form the second time around.
On my website the AutoComplete feature is never displayed for any forms that exist on that site. But yet other websites retain and deliver that content without problem.
My site is using PHP as the scripting language and all content is delivered over SSL.
I have determined that the problem is related to the Cache-Headers PHP sends out when the start_session() command is issued and the site is running SSL.
I have been able to get a hold of a person on the IE security team at Microsoft and they have confirmed that this is how IE is supposed to work. Here is a direct quote from the email.
"This is considered a feature of the autocomplete system. Significant code was written to make it behave this way."
When session_start(); is issued the default http headers php sends out are a no-cache header. Here is another quote from the Microsoft representitive.
If a secure page says "Don't cache me", that's an indication that the data is sensitive, and hence the autocomplete data itself is likely sensitive. Admittedly, it is a simple heuristic. Personally, I think it's a bit silly, but it's been there forever.
It's probably a good suggestion to support "autocomplete=on" to override the default heuristic.
In order to re-enable the autoComplete feature I had to issue this command in php before the start_session() command:
session_cache_limiter ('private, must-revalidate');
I'm sure there are other ways of manipulating the header cache-controls to allow the autoComplete to function as well.
Here is a link to 3 examples forms I made so you can test with IE.
dgavey - how are your forms being submitted? Microsoft isn't overly clear about this subtle issue, but;
YOU HAVE TO SUBMIT YOUR FORMS WITH A SUBMIT BUTTON
for this to work!
Unless of course you are like every site out there that likes to design their own forms thank you very much, and thus you'll need this hack to make IE behave.
http://webbugtrack.blogspot.com/2007/08/bug-137-ie-autocomplete-hardly-ever.html
which points the KB article here, where MS explains this really odd behavior.
Do you have autocomplete="off" as an attribute in your form elements?
Autocomplete is not used in IE when using SSL (which is mentioned in your tags, but not in your question).

Categories