Results 1 to 6 of 6

Thread: How is this done using php??

  1. #1

    How is this done using php??

    Firstly, Hello to all within Kirupa Forums!

    Secondly, Im very new to php programming but have been asked by my employer whether a specific function is possible and since ive already started on the php learning curve rather than asp/.net curve then is it possible to do it using php??

    please visit this site to see its functionality, since my question realtes to it (and its not my site by the way [i wish it was from a programming p.o.v!!]) - https://www.loancube.co.uk/

    my question is:
    does anyone know how the three dropdowns to the right change their icon from and arrow to a green tick when the user selects the correct option from its list. Is is dynamic/live validating - in that it shows a green tick when its good and a red cross when its wrong? if it isnt then is this possible??

    many thanks.

  2. #2
    You could do it with PHP but it would seem to be a bit over the top, and I'm pretty sure that page is acheiving it through javascript. Take a look at their script at https://www.loancube.co.uk/partners/...e_behaviour.js in particular the lines such as:

    Code:
    function checkAmount() {
    	if (checkDropDown(amount)) {
    		switchBackground(amount_l, 'tick');
    		sAmount = true;
    	}
    	else {
    		switchBackground(amount_l, 'cross');
    		sAmount = false;
    	}	
    }
    
    function checkPurpose() {
    	if (checkDropDown(purpose)) {
    		switchBackground(purpose_l, 'tick');
    		sPurpose = true;
    	}
    	else {
    		switchBackground(purpose_l, 'cross');
    		sPurpose = false;
    	}	
    }
    
    function checkHomeowner() {
    	if (checkDropDown(homeowner)) {
    		switchBackground(homeowner_l, 'tick');
    		sHomeowner = true;
    	}
    	else {
    		switchBackground(homeowner_l, 'cross');
    		sHomeowner = false;
    	}	
    }

  3. #3
    thank you duncanhall,!

    my nexy question: is it actually validating the selection?

  4. #4
    If you mean are they validating the user input, then the answer is pretty much no. There are only 3 drop-downs with which the user can enter any input, but the only data you can input is already defined by whatever is stipulated in the drop-down box, so it is not really neccessary.
    There is a small bit of validation done when cilcking the "Get Quote" button which simply checks to make sure you have selected any option for all 3 drop-downs:

    Code:
    function checkAll() {
        
        formvalid = true;
        
        // mandatory fields
        if (sAmount==false || sPurpose==false || sHomeowner==false) {
        formvalid = false;
        }
        
        if (formvalid == true) {
            switchVisibility(reminder, 'hide');
            return true;
        }
        else {
            switchVisibility(reminder, 'show');
            return false;
        }
    }

    The only other validation I can see being applied to this would be contextual - ie: "You can't borrow more than 50,000 for medical fees if you are not a homeowner", but they don't seem to have implemented anything like this.

  5. #5
    And that contextual validation is probably best done server side because Javascript can be easily manipulated on the user-end.

  6. #6
    Theres a great function for this built into the Spry Ajax framework that adobe is working on right now


    member #1 of the "XML-is-a-crutch-to-make-people-feel-elite-club"
    K-Emmys-06: Best Quote K-Emmys-06: Flash Genious

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012