What you really need is the ID of the generated form element. Use the
browser "view source" feature to see what you get for a form ID, then
you can something like:
drupal_add_js('$("#id-of-the-form").submit(function() { return
false; });', 'inline');
Of course, change "id-of-the-form" to the actual ID. If you pass
'inline' to the second argument of drupal_add_js, it will add a script
tag for you with the script content in the first argument. (you can
also leave off the 'inline' and pass a relative path to a .js file...
grep in the drupal modules dir for "drupal_add_js" to see many
examples).
Cheers,
--fletch
On Nov 11, 8:19 am, "bharani kumar" <[EMAIL PROTECTED]>
wrote:
> Hi ,
>
> U see , I am creating the custom form, the form contain 3 fields, when i
> submit the form , the page is reloading, so here i want to stop
>
> The page reload, so i want to use the JQuery , bcoz we can stop page reload
> using jquery,
>
> So here i need ur help the below code is my custom module code,
>
> tell me where i call the Jquery,
>
> this is my form
>
> function cityForm(){
>
> $form['txtWhere'] = array(
> '#title' => t('Where'),
> '#type' => 'textfield',
> '#description' => t(''),
> '#required' => TRUE,
> );
>
> $form['name'] = array(
> '#title' => t('Check-In'),
> '#type' => 'textfield',
> '#description' => t(''),
> '#attributes' => array('class' => 'jscalendar'),
> '#jscalendar_ifFormat' => '%Y-%m-%d %H:%M',
> '#jscalendar_showsTime' => 'true',
>
> );
>
> $form['txtChkOut'] = array(
> '#title' => t('Check-Out'),
> '#type' => 'textfield',
> '#description' => t(''),
> '#attributes' => array('class' => 'jscalendar'),
> '#jscalendar_ifFormat' => '%Y-%m-%d %H:%M',
> '#jscalendar_showsTime' => 'true',
> );
>
> $form['guest'] = array(
> '#type' => 'select',
> '#title' => t('Guests'),
> '#options' => array(
> 1 => '1',
> 2 => '2',
> 3 => '3',
> 4 => '4',
> 5 => '5',
> ),
> '#default_value' => '1',
> '#description' => t(''),
> '#required' => TRUE
> );
>
> $form['rooms'] = array(
> '#type' => 'select',
> '#title' => t('Rooms'),
> '#options' => array(
> 1 => '1',
> 2 => '2',
> 3 => '3',
> 4 => '4',
> 5 => '5',
> ),
> '#default_value' => '1',
> '#description' => t(''),
> '#required' => TRUE
> );
>
> $form['submit'] = array(
> '#type' => 'submit',
> '#value' => t('submit')
> );
> return $form;
>
> }
>
> This is genral form with submit action, if we process this form, If u
> submit the form, the page get reload,
>
> So i dont want to reload the page, at the time of form submit,
>
> So u please add the Jquery , and stop the page refresh
>
> 2008/11/11 bharani kumar <[EMAIL PROTECTED]>
>
>
>
> > Thanks for reply,
>
> > I want to integrate the Jquery in drupal
>
> > Am using the drupal 5,
>
> > Can u send any sample module ,
>
> > that sample module must contain the JQuery functionality ,
>
> > On Tue, Nov 11, 2008 at 9:22 PM, Eric Martin <[EMAIL PROTECTED]> wrote:
>
> >> Can you provide more information?
>
> >> - What version of Drupal are you using?
>
> >> - What are you trying to do?
>
> >> - What have you tried so far?
>
> >> On Nov 11, 6:38 am, "bharani kumar" <[EMAIL PROTECTED]>
> >> wrote:
> >> > Hi
>
> >> > Any one please tell me, how to use the jquery in Drupal,
>
> >> > --
> >> > உங்கள் நண்பன்
> >> > பரணி குமார்
>
> >> > Regards
> >> > B.S.Bharanikumar
>
> >> > POST YOUR OPINIONhttp://bharanikumariyer.hyperphp.com/
>
> > --
> > உங்கள் நண்பன்
> > பரணி குமார்
>
> > Regards
> > B.S.Bharanikumar
>
> > POST YOUR OPINION
> >http://bharanikumariyer.hyperphp.com/
>
> --
> உங்கள் நண்பன்
> பரணி குமார்
>
> Regards
> B.S.Bharanikumar
>
> POST YOUR OPINIONhttp://bharanikumariyer.hyperphp.com/