Radio buttons name: hinge_id, form: step3 Helper:
function $RC(form, name) { return $(form).getInputs('radio', name).find(function(radio) { if (radio.checked) { return radio; } }); } In callback: var hinge_id = $RC('step3', 'hinge_id'); if (hinge_id != null) { var hinge_id_regexp = new RegExp('hinge_id=([0-9]+)'); hinge_id_before = this.lastValue.match(hinge_id_regexp); hinge_id_now = this.getValue().match(hinge_id_regexp); if (hinge_id_before != null && hinge_id_before[1] != hinge_id_now[1]) { console.log(hinge_id_before + ':' + hinge_id_now); } } But it's very ugly, you know... On Oct 30, 12:14 pm, Dmitry Polushkin <[EMAIL PROTECTED]> wrote: > Hi everybody! > > First of all, prototype is a great library. > > But I have a problem with getting the last changed value in > Form.Observer. For example, if I'll do: > > new Form.Observer($(form), 0.2, some_callback_function); > > function some_callback_function() { > console.log(this.getValue()); > console.log(this.lastValue()); > > } > > It will log two different strings. But how to get diff between those > two values? > > I need that, because I have much of elements in form, and I need to > get name of the element, that have just changed. Form.Element.Observer > isn't suit to solve my problem, because I have set of radio buttons > (first argument of Form.Element.Observer is ID of input element). > > In previous example, I can search for string, like: / > (MyRadioButtonName)=[0-9]+/ > but is it a good practice, or? > > Thank you for your help, > Dmitry --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~----------~----~----~----~------~----~------~--~---