cforms II User Forum

Registration is currently disabled.
Guest

FAQs

Login form protected by Login LockDown.


Lost password?
Advanced Search

— Forum Scope —

  

— Match —

   

— Forum Options —

    

Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
adding input events (onblur, onfocus)
January 2, 2008
7:20 pm
adrianliem
Guest

Please replace the ??? with your data!

  • Your URL: localhost – still testing
  • The browser used: firefox 1.5
  • cforms version: 6.5
  • Your Wordpress version: 2.3.1

i've search the forum but found none about form events, so:

problem 

i have 3 main fields (select-box type input tags) for a travel site that i develop:

1. Trip Type (value = One Way, Return)
2. From (List of Cities)
3. To (List of Cities, disabled by default)

the default setting for the "To" field is disabled, it only should be enabled when the "Trip Type" field is set to "Return"

currently i cannot modify the disabled/enabled input properties because i cannot find the way to add events (onfocus, onblur) to the fields 

questions

1. can i do that through the cforms II settings?
2. or should i create/modify some files? which files? (javascript, php, what are the name of the files?)
3. how? which reference(s)/document(s) that i should read?

thanks in advance,
cforms has helps me a lot Smile

January 2, 2008
11:26 pm
Oliver
Munich, Germany
Admin
Forum Posts: 6400
Member Since:
March 6, 2005
Offline

Per configuration you can not add any JS events to input fields – the only ones supported are for "auto clear" and "default field value".

Also, there is no JS / real-time workflow possible with cforms. If you need something to that extend you may want to start from scratch. Modifying cforms base code may open up Pandora's box.

As flexible as cforms is, this is a direction it will not grow into, simply because it wouldn't be compatible with non JS environments. Sorry for the not so good news. ;-)

January 4, 2008
1:26 pm
adrianliem
Guest

this is indeed a bad news :)

altough i think that the non JS environment will makes cforms less flexible and cannot be used in the complex form-page requirements, but i do respect your policy :)

ok, i suppose i will try to save the generated html source from cforms, and then edit it so that it can contain the events -- i really need to use the events. i hope this workaround can work :)

cforms is still a great plugin anyway -- thanks for making it happen

God bless u and your family,

January 12, 2008
11:02 pm
Ryan
Guest

Thanks Oliver, that worked. I have the form working with PayPal for a non-specified amount. I'm not a Java guru, so I'm not sure about writing a snippet for the mouse-up event. I did find something on the PayPal Developer site about using select menus for multiple prices. I can use the following code:

<select name='item_price'>
<option value='50.00'>$50</option>
<option value='75.00'>$75</option>
<option value='100.00'>$100</option>
</select>

However, this requires me to be able to alter the "name" of the select menu without also modifying the "label". As you can see, it wouldn't make sense for the site user to see "item_price" printed next to the dropdown menu. Is there a way to change the name of the select menu, or is this hard-coded?

For a form requirement this complex, it may require me to build the form in HTML. Your plug-in was originally supposed to be for "contact" forms only, was it not? Smile

January 13, 2008
11:15 am
Oliver
Munich, Germany
Admin
Forum Posts: 6400
Member Since:
March 6, 2005
Offline

However, this requires me to be able to alter the "name" of the select menu without also modifying the "label". As you can see, it wouldn’t make sense for the site user to see "item_price" printed next to the dropdown menu. Is there a way to change the name of the select menu, or is this hard-coded?

This is something I had been thinking of, which technically isn't such a big deal, but it will make the configuration of cforms even more complex as it would introduce another attribute to each input element.

However, an acceptable workaround would be to…

  1. use CSS to set "display:none;" to the field label (make sure to have field label ID's activated.
  2. and instead add a text-only field above it with the actual/shown name.
  3. If you have label and select box on the same line, you can use some additional CSS to "move up" the select box on the same level. Easy.

For a form requirement this complex, it may require me to build the form in HTML. Your plug-in was originally supposed to be for "contact" forms only, was it not?

 Yep, that's how it all started out….

Forum Timezone: Europe/Berlin

Most Users Ever Online: 959

Currently Online:
24 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

tracedef: 43

mores: 21

Gyrus: 20

frozenwaste: 18

asuffredini: 15

photoworks: 14

Member Stats:

Guest Posters: 3762

Members: 1463

Moderators: 3

Admins: 2

Forum Stats:

Groups: 1

Forums: 4

Topics: 5361

Posts: 18742

Newest Members: juredujmovic, dreamkeeper, rajattyagi, wrokaa, lukass

Moderators: Paul (421), cnymike (8), sonika (95)

Administrators: Oliver (6400), Nicky (3)